-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
3.13.0a4 SIGSEGV when calling next on a list-iterator in for that loops the same iterator #115733
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
Labels
3.13
bugs and security fixes
release-blocker
topic-free-threading
type-crash
A hard crash of the interpreter, possibly with a core dump
Comments
Flask-less reproducer with werkzeug only:
|
Werkzeug-less reproducer: parts = iter([...] * 3) # odd number of elements
for part in parts:
next(parts, ...) |
When the iterator is made from a tuple, it does not crash. If it has an even number of elements, it does not crash (only small integers tested). |
This example (from Python 3.12) shows why odd-number of elements matter: >>> parts = iter([1,2,3,4,5])
>>>
>>> for part in parts:
... print('P', part)
... print('N', next(parts, ...))
...
P 1
N 2
P 3
N 4
P 5
N Ellipsis
>>> parts = iter([1,2,3,4])
>>>
>>> for part in parts:
... print('P', part)
... print('N', next(parts, ...))
...
P 1
N 2
P 3
N 4 |
Reproduces on the current main branch. |
One-liner: Python 3.13.0a4+ (heads/main:d207c7cd5a, Feb 20 2024, 17:21:59) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for part in (parts := iter([1])): next(parts, 1)
...
1
[1] 29737 segmentation fault ./python.exe |
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Feb 20, 2024
corona10
pushed a commit
that referenced
this issue
Feb 20, 2024
I was about to do that, but probably tmrw. |
All good. Thanks. |
befeleme
pushed a commit
to fedora-python/cpython
that referenced
this issue
Feb 22, 2024
woodruffw
pushed a commit
to woodruffw-forks/cpython
that referenced
this issue
Mar 4, 2024
…115740) * pythongh-115733: Fix crash involving exhausted iterator * Add blurb
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
…115740) * pythongh-115733: Fix crash involving exhausted iterator * Add blurb
LukasWoodtli
pushed a commit
to LukasWoodtli/cpython
that referenced
this issue
Jan 22, 2025
…115740) * pythongh-115733: Fix crash involving exhausted iterator * Add blurb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.13
bugs and security fixes
release-blocker
topic-free-threading
type-crash
A hard crash of the interpreter, possibly with a core dump
Bug report
Bug description:
EDIT smaller reproducer:
Hello, when we try to build Flask in Fedora with Python 3.13.0a4, we see a SIGSEGV. With @befeleme we've been able to isolate the failure to the following:
Here's a bt from gdb:
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: