From 10ff2ec9ca61fb39187b9ab2fe0fb1965251ca24 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Mon, 29 Aug 2016 12:28:00 +0200 Subject: [PATCH] Workaround to prevent this calculation to blow the stack Specifically, the CPython interpreter's symbol visibility analysis makes recursive calls into a function called `symtable_visit_expr`, and can overflow the stack when analyzing a very large expression of binary operators (this also came up in this ticket: https://trac.sagemath.org/ticket/16014). While I seek a more general fix to that problem, we need to work around it. In this case the polynomial `psi` is converted one term at a time, and then summed, rather than summed first and then converted (resulting in evaluating a very large Singular polynomial). The result is the same either way though might be slightly slower with this workaround, though I haven't tested. --- src/sage/schemes/elliptic_curves/isogeny_small_degree.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 63e6ef7a8ff..3c2200876f1 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -1493,9 +1493,8 @@ def Psi2(l): t += [(c[n]-(4*n-2)*A*t[n-1]-(4*n-4)*B*t[n-2])*(1/QQ(4*n+2))] for n in range(1,d+1): s += [(-1/QQ(n))*sum((-1)**i*t[i]*s[n-i] for i in range(1,n+1))] - psi = sum((-1)**i*s[i]*x**(d-i) for i in range(0,d+1)) R = PolynomialRing(QQ,['x','u','v']) - return R(psi) + return sum(R((-1)**i*s[i]*x**(d-i)) for i in range(0,d+1)) def isogenies_prime_degree_genus_plus_0(E, l=None):