Skip to content

Fix _Pickle.reducer_override annotation #13545

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion stdlib/pickle.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ class _Pickler:
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
bin: bool # undocumented
dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only
reducer_override: Callable[[Any], Any]
def __init__(
self,
file: SupportsWrite[bytes],
Expand All @@ -216,6 +215,10 @@ class _Pickler:
def dump(self, obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
# The following method is not defined on _Pickler, but can be defined on
# sub-classes. Should return `NotImplemented` if pickling the supplied
# object is not supported and returns the same types as `__reduce__()`.
def reducer_override(self, obj: object, /) -> _ReducedType: ...

class _Unpickler:
dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only
Expand Down