Skip to content

Add _Pickler and _Unpickler to stdlib/pickle #5506

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

Merged
merged 1 commit into from
May 19, 2021

Conversation

dreiss
Copy link
Contributor

@dreiss dreiss commented May 19, 2021

These are the pure-Python pickle implementation, and are sometimes used
by code that wants to extend or override parts of the
pickling/unpickling process.

These are the pure-Python pickle implementation, and are sometimes used
by code that wants to extend or override parts of the
pickling/unpickling process.
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/compat/pickle_compat.py:201: error: unused "type: ignore" comment
+ pandas/compat/pickle_compat.py:209: error: "Type[Unpickler]" has no attribute "dispatch"  [attr-defined]
+ pandas/compat/pickle_compat.py:210: error: "Type[Unpickler]" has no attribute "dispatch"  [attr-defined]
+ pandas/compat/pickle_compat.py:234: error: "Type[Unpickler]" has no attribute "dispatch"  [attr-defined]
+ pandas/compat/pickle_compat.py:251: error: "Type[Unpickler]" has no attribute "dispatch"  [attr-defined]
+ pandas/compat/pickle_compat.py:272: error: "Unpickler" has no attribute "is_verbose"  [attr-defined]

@Akuli
Copy link
Collaborator

Akuli commented May 19, 2021

dispatch attribute is missing, but can be added in a separate PR.

@Akuli Akuli merged commit 1547035 into python:master May 19, 2021
@dreiss
Copy link
Contributor Author

dreiss commented May 19, 2021

dispatch attribute is missing, but can be added in a separate PR.

Hrm. I didn't realize that would be an issue. I used this with pyre on a file that was using dispatch and it made all of my errors go away. Fixing this will probably be more involved. Since Unpickler doesn't have dispatch (I don't think), _Unpickler will probably need to be made into a full separate type, rather than just an alias.

@Akuli
Copy link
Collaborator

Akuli commented May 19, 2021

I created #5508 to add dispatch. So far I just added it to both, which is not ideal, but at least you won't get an error when you try to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants