From 1c3f526fbf5e9c4981526549c325d30c1a7be3f4 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Fri, 26 Jun 2020 03:29:47 -0700 Subject: [PATCH] pickle: improve positional-arg accuracy in py39 and others (#4273) Although technically data in loads is not positional-only in py38, but we decided that that doesn't matter Co-authored-by: hauntsaninja <> --- stdlib/2and3/pickle.pyi | 6 +++--- tests/stubtest_whitelists/py3_common.txt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stdlib/2and3/pickle.pyi b/stdlib/2and3/pickle.pyi index 2b0124274..e7b1b02d0 100644 --- a/stdlib/2and3/pickle.pyi +++ b/stdlib/2and3/pickle.pyi @@ -32,7 +32,7 @@ if sys.version_info >= (3, 8): errors: str = ..., buffers: Optional[Iterable[Any]] = ... ) -> Any: ... def loads( - data: bytes, *, fix_imports: bool = ..., encoding: str = ..., + __data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ..., buffers: Optional[Iterable[Any]] = ... ) -> Any: ... elif sys.version_info >= (3, 0): @@ -79,7 +79,7 @@ class Pickler: else: def __init__(self, file: IO[bytes], protocol: Optional[int] = ...) -> None: ... - def dump(self, obj: Any) -> None: ... + def dump(self, __obj: Any) -> None: ... def clear_memo(self) -> None: ... def persistent_id(self, obj: Any) -> Any: ... @@ -95,7 +95,7 @@ class Unpickler: def __init__(self, file: IO[bytes]) -> None: ... def load(self) -> Any: ... - def find_class(self, module: str, name: str) -> Any: ... + def find_class(self, __module_name: str, __global_name: str) -> Any: ... if sys.version_info >= (3, 0): def persistent_load(self, pid: Any) -> Any: ... diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 1d97490b2..450e83267 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -338,7 +338,6 @@ os._Environ.__init__ os._Environ.setdefault os._wrap_close.__init__ pickle.Pickler.persistent_id -pickle.Unpickler.find_class pickle.Unpickler.persistent_load pipes.Template.copy pkgutil.ImpImporter.__init__