-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Failed assertion in itertoolsmodule.c: itertools_count_impl
for count(sys.maxsize)
#126595
Comments
cc @rhettinger |
Note, that on non-debug builds there is no crash: Python 3.13.0rc1+ (heads/3.13:bd29ce8509, Aug 29 2024, 15:30:15) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import maxsize
>>> from itertools import count
>>> c = count(maxsize)
>>> next(c)
9223372036854775807
>>> next(c)
9223372036854775808
>>> next(c)
9223372036854775809 So, I don't think this should be backported. On another hand, we have an issue with repl. Continuing the above example: >>> count(maxsize)
count(<NULL>) This seems to be fixed by pr. |
I think we should still backport fixes for non-debug builds because people might want to use debug builds for themselves. |
Nice find! If we take it further, another assertion fails: Python 3.14.0a1+ experimental free-threading build (heads/main:6293d00, Nov 9 2024, 07:56:06) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import maxsize; from itertools import count
>>> c = count(maxsize - 2)
>>> for x in c:
... print(c, x)
...
count(9223372036854775806) 9223372036854775805
python: Objects/unicodeobject.c:3046: unicode_fromformat_arg: Assertion `obj' failed.
Aborted (core dumped) |
Ah the PR does not fix this second assertion on unicode objects. I'll work a bit more. Thanks for finding it. |
Update: I found the issue. When the counter reaches |
…e)` (pythonGH-126617) (cherry picked from commit 6e3bb8a) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Closing since completed and backported. Thank you all. |
Crash report
What happened?
Calling
itertools.count(sys.maxsize)
aborts with the following message:Found using fusil by @vstinner.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux, Windows
Output from running 'python -VV' on the command line:
Python 3.14.0a1+ (heads/main:4ea214ea982, Nov 6 2024, 00:52:15) [MSC v.1941 64 bit (AMD64)]
Linked PRs
itertools.count(sys.maxsize)
#126617itertools.count(sys.maxsize)
(GH-126617) #126739itertools.count(sys.maxsize)
(GH-126617) #126740The text was updated successfully, but these errors were encountered: