Repository navigation
gh-141749: fix incorrect exceptions in pure Python Unpickler - #141751
literally-user wants to merge 5 commits into
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
| assert isinstance(key, bytes_types) | ||
| dispatch[key[0]](self) | ||
| try: | ||
| dispatch[key[0]](self) |
There was a problem hiding this comment.
Do not catch a KeyError for the call. Use a temporary variable for the dispatcher first.
|
|
||
| unpickler = pickle._Unpickler | ||
| bad_stack_errors = (IndexError,) | ||
| bad_stack_errors = (IndexError, pickle.UnpicklingError) |
There was a problem hiding this comment.
Shpuld we still catch IndexError now?
|
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 |
|
Ah I didn't that we had a second PR for that by the OP. Usually it is polite to ask the OP if they want to make a PR before making it one, and they did so a bit after. In this case I am actually going to close this one. Sorry. |
Fixed incorrect exception types occurring in the CPython
Unpicklerimplementation when loading invalid pickle data. In some cases, the CPython fallback raised internalKeyErrorandIndexErrorexceptions instead ofUnpicklingError.This PR adds correct error handling in both places so that UnpicklingError is raised consistently.