Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-105375: Improve error handling in _Unpickler_SetInputStream()#105667
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-105375: Improve error handling in _Unpickler_SetInputStream()#105667
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Prevent exceptions from possibly being overwritten in case of multiplefailures.
erlend-aasland commentedJun 11, 2023
@serhiy-storchaka, would you have time to look at this bugfix? |
serhiy-storchaka left a comment
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.
I think you missed the purpose_PyObject_LookupAttr(). It was designed to get rid ofPyErr_ExceptionMatches(PyExc_AttributeError) checks and the overhead of raising and catching an exception.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
- There's no need to match AttributeError, since _PyObject_LookupAttr() converts that exception into a return value of 0.- We can use the result output variable instead of adding temporary boolean indicators.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Don't clear arbitrary exceptions
Uh oh!
There was an error while loading.Please reload this page.
There's no need for PyErr_Occurred() anymore
erlend-aasland commentedJun 13, 2023
Thanks for the very helpful review and historical insight, Serhiy. |
miss-islington commentedJun 13, 2023
Thanks@erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
bedevere-bot commentedJun 13, 2023
GH-105720 is a backport of this pull request to the3.12 branch. |
bedevere-bot commentedJun 13, 2023
GH-105721 is a backport of this pull request to the3.11 branch. |
…Stream() (python#105667)Prevent exceptions from possibly being overwritten in case of multiplefailures.(cherry picked from commit217589d)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
…Stream() (python#105667)Prevent exceptions from possibly being overwritten in case of multiplefailures.(cherry picked from commit217589d)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Prevent exceptions from possibly being overwritten in case of multiple
failures.