Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError in int <-> str conversions #3

Open
tueda opened this issue Sep 21, 2022 · 0 comments
Open

ValueError in int <-> str conversions #3

tueda opened this issue Sep 21, 2022 · 0 comments

Comments

@tueda
Copy link
Owner

tueda commented Sep 21, 2022

In complicated systems, it is often the case that fixing your bug causes a new bug for others. The latest CPython bugfix releases have introduced a breaking change in conversions between large integers and strings. So far, no alternate API has been provided except for changing global settings (which is not appropriate for libraries).

There are at least 3 places in this library affected by this change.

self._raw = _RawPolynomial(str(value))

python -c 'import donuts; donuts.Polynomial(10**4300)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/donuts/poly.py", line 74, in __init__
    self._raw = _RawPolynomial(str(value))
ValueError: Exceeds the limit (4300) for integer string conversion

return int(str(self))

python -c 'import donuts; (donuts.Polynomial(10)**4300).as_integer'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/donuts/poly.py", line 266, in as_integer
    return int(str(self))
ValueError: Exceeds the limit (4300) for integer string conversion: value has 4301 digits

self._raw = _RawRationalFunction(str(numerator))

python -c 'import donuts; donuts.RationalFunction(10**4300)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/donuts/rat.py", line 64, in __init__
    self._raw = _RawRationalFunction(str(numerator))
ValueError: Exceeds the limit (4300) for integer string conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant