From 7ff188524c44fca10d40368cc8ccf6941c06ba02 Mon Sep 17 00:00:00 2001 From: Nathan Dunfield Date: Tue, 2 Jun 2026 13:35:36 -0500 Subject: [PATCH 1/2] Newer versions of Python will not convert long decimal strings to integers by default, so we remove that limitation --- realalg/base_algebraic.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/realalg/base_algebraic.py b/realalg/base_algebraic.py index ad4218e..3fb3c58 100644 --- a/realalg/base_algebraic.py +++ b/realalg/base_algebraic.py @@ -8,6 +8,13 @@ from numbers import Integral import sympy as sp +# By default, Python will only convert a decimal string of length at +# most 4300 to an intger, to protect against DDOS attacks not relevant +# here (CVE-2020-10735). +import sys +if hasattr(sys, 'set_int_max_str_digits'): + sys.set_int_max_str_digits(0) + from .interval import Interval sp_x = sp.Symbol('x') From e331d11a81f193a7d0bc9f18bed2f5c6f1b0e577 Mon Sep 17 00:00:00 2001 From: Mark Bell Date: Fri, 19 Jun 2026 23:51:34 +0100 Subject: [PATCH 2/2] Reorder imports --- realalg/base_algebraic.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/realalg/base_algebraic.py b/realalg/base_algebraic.py index 3fb3c58..8e9cc6f 100644 --- a/realalg/base_algebraic.py +++ b/realalg/base_algebraic.py @@ -6,14 +6,9 @@ from functools import total_ordering from math import log10 as log from numbers import Integral -import sympy as sp - -# By default, Python will only convert a decimal string of length at -# most 4300 to an intger, to protect against DDOS attacks not relevant -# here (CVE-2020-10735). import sys -if hasattr(sys, 'set_int_max_str_digits'): - sys.set_int_max_str_digits(0) + +import sympy as sp from .interval import Interval @@ -21,6 +16,12 @@ sp_QQ_x = sp.QQ.old_poly_ring(sp_x) LOG_2 = log(2) +# By default, Python will only convert a decimal string of length at +# most 4300 to an integer to protect against DDOS attacks; not relevant +# here (CVE-2020-10735). +if hasattr(sys, 'set_int_max_str_digits'): + sys.set_int_max_str_digits(0) + def log_plus(x): ''' Return the height of the number ``x``. ''' return log(max(1, abs(x)))