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
iter __reduce__ can segfault if accessing __builtins__.__dict__['iter'] mutates the iter object
#101765
Comments
|
This (horrific) reproducer provokes undefined defined behavior from this statement: Lines 243 to 244 in f1f3af7
The call to On some platforms, |
iter.__reduce__ can segfault if accessing __builtins__.__dict__['iter'] exhausts the iter object__reduce__ can segfault if accessing __builtins__.__dict__['iter'] mutates the iter object
…when internal access of `builtins.__dict__` exhausts the iterator (#101769)
…`__reduce__` when internal access of `builtins.__dict__` exhausts the iterator (pythonGH-101769). (cherry picked from commit 54dfa14) Co-authored-by: Ionite <dev@ionite.io>
…`__reduce__` when internal access of `builtins.__dict__` exhausts the iterator (pythonGH-101769). (cherry picked from commit 54dfa14) Co-authored-by: Ionite <dev@ionite.io>
…`__reduce__` when internal access of `builtins.__dict__` exhausts the iterator (pythonGH-101769). (cherry picked from commit 54dfa14) Co-authored-by: Ionite <dev@ionite.io>
…ing (pythonGH-102265) Followup from pythonGH-101769.. (cherry picked from commit d71edbd) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…ing (pythonGH-102265) Followup from pythonGH-101769.. (cherry picked from commit d71edbd) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>


Crash report
Example from @chilaxan
Expected result
This should return a valid
__reduce__tuple of the exhausted iterator. Instead behavior is inconsistent between segmentation faults, SystemErrors, and sometimes returning the iterator without being exhausted.Error messages
PYTHONMALLOC=debugPYTHONMALLOC=debugPYTHONMALLOC=debugLinked PRs
__reduce__when internal access ofbuiltins.__dict__exhausts the iterator #101769__reduce__when internal access ofbuiltins.__dict__exhausts the iterator (GH-101769) #102228__reduce__when internal access ofbuiltins.__dict__exhausts the iterator (GH-101769) #102229The text was updated successfully, but these errors were encountered: