Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
Closed
Description
Crash report
Example from@chilaxan
corrupt=iter(lambda:0,0)classCstr:def__hash__(self):returnhash('iter')def__eq__(self,other): [*corrupt]returnother=='iter'builtins=__builtins__.__dict__ifhasattr(__builtins__,'__dict__')else__builtins__oiter=builtins['iter']delbuiltins['iter']builtins[Cstr()]=oiterprint(corrupt.__reduce__())
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
- 3.11, windows,
PYTHONMALLOC=debug
- 3.12.0a4, windows,
PYTHONMALLOC=debug
Windowsfatalexception:accessviolation>exitcode-1073741819 (0xC0000005)
- 3.12.04a4, windows, compiled with debug mode
print(corrupt.__reduce__())^^^^^^^^^^^^^^^^^^^^SystemError:NULLobjectpassedtoPy_BuildValue
- 3.11, ubuntu
(<built-infunctioniter>, (<functionat0x7fb772c3c4a0>,0))>terminatedbysignalSIGSEGV (Addressboundaryerror)
- 3.12.0a4, ubuntu
(<built-infunctioniter>, (<functionat0x7f3480d71f80>,0))
- 3.12.0a4, ubuntu,
PYTHONMALLOC=debug
FatalPythonerror:Segmentationfault
Linked PRs
- gh-101765: Fix SystemError / segmentation fault in iter
__reduce__
when internal access ofbuiltins.__dict__
exhausts the iterator #101769 - [3.11] gh-101765: Fix SystemError / segmentation fault in iter
__reduce__
when internal access ofbuiltins.__dict__
exhausts the iterator (GH-101769) #102228 - [3.10] gh-101765: Fix SystemError / segmentation fault in iter
__reduce__
when internal access ofbuiltins.__dict__
exhausts the iterator (GH-101769) #102229 - gh-101765: Fix refcount issues in list and unicode pickling #102265
- [3.11] gh-101765: Fix refcount issues in list and unicode pickling (G… #102268
- [3.10] gh-101765: Fix refcount issues in list and unicode pickling (G… #102269
- gh-101765: unicodeobject: use Py_XDECREF correctly #102283
- [3.11] gh-101765: unicodeobject: use Py_XDECREF correctly (GH-102283) #102285
- [3.10] gh-101765: unicodeobject: use Py_XDECREF correctly (GH-102283) #102286