Skip to content

Commit c44fd16

Browse files
author
Matthias Koeppe
committed
Use LazyFormat to fix infinite loop
1 parent 8084b69 commit c44fd16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sage/rings/number_field/number_field.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,9 @@ def _Hom_(self, codomain, category=None):
19131913
True
19141914
"""
19151915
if not is_NumberFieldHomsetCodomain(codomain):
1916-
raise TypeError("{} is not suitable as codomain for homomorphisms from {}".format(codomain, self))
1916+
# Using LazyFormat fixes #28036 - infinite loop
1917+
from sage.misc.lazy_format import LazyFormat
1918+
raise TypeError(LazyFormat("%s is not suitable as codomain for homomorphisms from %s") % (codomain, self))
19171919
from .morphism import NumberFieldHomset
19181920
return NumberFieldHomset(self, codomain, category)
19191921

0 commit comments

Comments
 (0)