mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-09 06:46:18 +08:00
Fix typing of Pickler.persistent_id and Unpickler.persistent_load for Python < 3.13. (#13818)
This commit is contained in:
@@ -295,3 +295,9 @@ typing_extensions\.Annotated # Undocumented implementation details
|
||||
# (Remove once 3.10.17 becomes available for all platforms)
|
||||
(email._header_value_parser.get_encoded_word)?
|
||||
(email._header_value_parser.make_quoted_pairs)?
|
||||
|
||||
# These methods have no default implementation for Python < 3.13.
|
||||
_pickle.Pickler.persistent_id
|
||||
_pickle.Unpickler.persistent_load
|
||||
pickle.Pickler.persistent_id
|
||||
pickle.Unpickler.persistent_load
|
||||
|
||||
@@ -259,3 +259,9 @@ typing_extensions\.Annotated # Undocumented implementation details
|
||||
# (Remove once 3.11.12 becomes available for all platforms)
|
||||
(email._header_value_parser.get_encoded_word)?
|
||||
(email._header_value_parser.make_quoted_pairs)?
|
||||
|
||||
# These methods have no default implementation for Python < 3.13.
|
||||
_pickle.Pickler.persistent_id
|
||||
_pickle.Unpickler.persistent_load
|
||||
pickle.Pickler.persistent_id
|
||||
pickle.Unpickler.persistent_load
|
||||
|
||||
@@ -228,3 +228,9 @@ sunau.Au_write.initfp
|
||||
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
|
||||
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
|
||||
typing_extensions\.Annotated # Undocumented implementation details
|
||||
|
||||
# These methods have no default implementation for Python < 3.13.
|
||||
_pickle.Pickler.persistent_id
|
||||
_pickle.Unpickler.persistent_load
|
||||
pickle.Pickler.persistent_id
|
||||
pickle.Unpickler.persistent_load
|
||||
|
||||
@@ -245,3 +245,9 @@ typing_extensions\.Annotated # Undocumented implementation details
|
||||
# Incompatible changes introduced in Python 3.9.22
|
||||
# (Remove once 3.9.22 becomes available for all platforms)
|
||||
(email._header_value_parser.get_encoded_word)?
|
||||
|
||||
# These methods have no default implementation for Python < 3.13.
|
||||
_pickle.Pickler.persistent_id
|
||||
_pickle.Unpickler.persistent_load
|
||||
pickle.Pickler.persistent_id
|
||||
pickle.Unpickler.persistent_load
|
||||
|
||||
+6
-9
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, SupportsWrite
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from pickle import PickleBuffer as PickleBuffer
|
||||
@@ -75,10 +74,9 @@ class Pickler:
|
||||
def memo(self, value: PicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
|
||||
def dump(self, obj: Any, /) -> None: ...
|
||||
def clear_memo(self) -> None: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def persistent_id(self, obj: Any, /) -> Any: ...
|
||||
else:
|
||||
persistent_id: Callable[[Any], Any]
|
||||
|
||||
# this method has no default implementation for Python < 3.13
|
||||
def persistent_id(self, obj: Any, /) -> Any: ...
|
||||
|
||||
@type_check_only
|
||||
class UnpicklerMemoProxy:
|
||||
@@ -101,7 +99,6 @@ class Unpickler:
|
||||
def memo(self, value: UnpicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
|
||||
def load(self) -> Any: ...
|
||||
def find_class(self, module_name: str, global_name: str, /) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def persistent_load(self, pid: Any, /) -> Any: ...
|
||||
else:
|
||||
persistent_load: Callable[[Any], Any]
|
||||
|
||||
# this method has no default implementation for Python < 3.13
|
||||
def persistent_load(self, pid: Any, /) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user