gh-82565: Fix a possible assertion failure in _pickle#16606
gh-82565: Fix a possible assertion failure in _pickle#16606serhiy-storchaka merged 13 commits intopython:mainfrom
Conversation
In _Unpickler_SetInputStream(), _PyObject_LookupAttrId() is called three times in a row without any error handling. If an exception occurs during the first or second call, _PyObject_LookupAttrId() will be called with a live exception.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Minimal reproducer (but you can add class F:
@property
def read(self):
1/0
import pickle
pickle.load(F()) |
|
@ZackerySpytz Ping? |
|
Hi @ZackerySpytz! This is looking good! Make sure to also add a NEWS entry (you can use blurb-it). |
@ZackerySpytz has added a test. Shall we merge this? |
|
LGTM. @serhiy-storchaka |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM.
Please add few more test cases:
- no
read, noreadline read = bad_property, noreadlinereadline = bad_property, noread
|
Sorry, I forget to merge this PR at its time, so the original issue was fixed in #105667. But the tests may still be useful. |
|
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…honGH-16606) (cherry picked from commit 0584443) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
GH-112591 is a backport of this pull request to the 3.12 branch. |
|
GH-112592 is a backport of this pull request to the 3.11 branch. |
…honGH-16606) (cherry picked from commit 0584443) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
In _Unpickler_SetInputStream(), _PyObject_LookupAttrId() is called
three times in a row without any error handling. If an exception
occurs during the first or second call, _PyObject_LookupAttrId()
will be called with a live exception.
https://bugs.python.org/issue38384