-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-82565: Fix a possible assertion failure in _pickle #16606
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
gh-82565: Fix a possible assertion failure in _pickle #16606
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Please add few more test cases:
- no
read
, noreadline
read = bad_property
, noreadline
readline = 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 <[email protected]>
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 <[email protected]>
…-16606) (GH-112591) (cherry picked from commit 0584443) Co-authored-by: Zackery Spytz <[email protected]>
…-16606) (GH-112592) (cherry picked from commit 0584443) Co-authored-by: Zackery Spytz <[email protected]>
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