Skip to content

Commit b18a9c5

Browse files
authored
Merge pull request LMFDB#7129 from roed-math/fix-cm-field-mixed-types
Fix 500 on CM elliptic curve isogeny class pages
2 parents 74d3f96 + 7bbc48c commit b18a9c5

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lmfdb/elliptic_curves/isog_class.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def perm(i): return next(c for c in self.curves if c['Cnumber'] == i+1)['lmfdb_n
175175
if self.cm:
176176
# set CM field for Properties box.
177177
D = integer_squarefree_part(ZZ(self.cm))
178-
coeffs = [(1-D)//4,-1,1] if D % 4 == 1 else [-D,0,1]
178+
# int() everything so that the query list is not a mix of Sage Integers
179+
# and Python ints, which psycopg cannot adapt
180+
coeffs = [int((1-D)//4),-1,1] if D % 4 == 1 else [int(-D),0,1]
179181
lab = db.nf_fields.lucky({'coeffs': coeffs}, projection='label')
180182
self.CMfield = field_pretty(lab)
181183
else:

lmfdb/elliptic_curves/test_ell_curves.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ def test_isogeny_class(self):
126126
L = self.tc.get('/EllipticCurve/Q/11/a/')
127127
assert '[0, -1, 1, 0, 0]' in L.get_data(as_text=True)
128128

129+
def test_cm_isogeny_class(self):
130+
# The CM field shown in the Properties box is looked up in nf_fields
131+
# by coefficient list; this 500ed when that list mixed Sage Integers
132+
# with Python ints (see #7129). 27.a and 32.a exercise the two
133+
# branches computing the coefficient list.
134+
L = self.tc.get('/EllipticCurve/Q/27/a/')
135+
assert r'\Q(\sqrt{-3})' in L.get_data(as_text=True)
136+
L = self.tc.get('/EllipticCurve/Q/32/a/')
137+
assert r'\Q(\sqrt{-1})' in L.get_data(as_text=True)
138+
129139
def test_dl_qexp(self):
130140
L = self.tc.get('/EllipticCurve/Q/download_qexp/66.c3/100')
131141
assert '0,1,1,1,1,-4,1,-2,1,1,-4,1,1,4,-2,-4,1,-2,1,0,-4,-2,1,-6,1,11,4,1,-2,10,-4,-8,1,1,-2,8,1,-2,0,4,-4,2,-2,4,1,-4,-6,-2,1,-3,11,-2,4,4,1,-4,-2,0,10,0,-4,-8,-8,-2,1,-16,1,-12,-2,-6,8,2,1,-6,-2,11,0,-2,4,10,-4,1,2,4,-2,8,4,10,1,10,-4,-8,-6,-8,-2,0,1,-2,-3,1,11' in L.get_data(as_text=True)

0 commit comments

Comments
 (0)