Skip to content

Commit 1487984

Browse files
committed
Enhance an error message
1 parent fbaf715 commit 1487984

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,11 @@ def __classcall_private__(cls, function_ring, gen, name='t'):
589589
base_morphism = Hom(function_ring, base_field_noext)(gen[0])
590590
base_field = base_field_noext.over(base_morphism)
591591

592+
# This test is also done in the category. We put it here also
593+
# to have a friendlier error message
594+
if not base_field.is_field():
595+
raise ValueError('generator coefficients must live in a field')
596+
592597
category = DrinfeldModules(base_field, name=name)
593598

594599
# Check gen as Ore polynomial

0 commit comments

Comments
 (0)