Uh oh!
There was an error while loading. Please reload this page.
gh-105375: Improve error handling in _Unpickler_SetInputStream() - #105667
Conversation
Prevent exceptions from possibly being overwritten in case of multiple failures.
erlend-aasland
commented
Jun 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.
I think you missed the purpose _PyObject_LookupAttr(). It was designed to get rid of PyErr_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
commented
Jun 13, 2023
Thanks for the very helpful review and historical insight, Serhiy. |
miss-islington
commented
Jun 13, 2023
Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
bedevere-bot
commented
Jun 13, 2023
GH-105720 is a backport of this pull request to the 3.12 branch. |
bedevere-bot
commented
Jun 13, 2023
GH-105721 is a backport of this pull request to the 3.11 branch. |
…Stream() (python#105667) Prevent exceptions from possibly being overwritten in case of multiple failures. (cherry picked from commit 217589d) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
…Stream() (python#105667) Prevent exceptions from possibly being overwritten in case of multiple failures. (cherry picked from commit 217589d) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Prevent exceptions from possibly being overwritten in case of multiple
failures.