summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/copy.py
diff options
context:
space:
mode:
authorshadchin <[email protected]>2024-02-12 07:53:52 +0300
committerDaniil Cherednik <[email protected]>2024-02-14 14:26:16 +0000
commit31f2a419764a8ba77c2a970cfc80056c6cd06756 (patch)
treec1995d239eba8571cefc640f6648e1d5dd4ce9e2 /contrib/tools/python3/src/Lib/copy.py
parentfe2ef02b38d9c85d80060963b265a1df9f38c3bb (diff)
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Lib/copy.py')
-rw-r--r--contrib/tools/python3/src/Lib/copy.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/contrib/tools/python3/src/Lib/copy.py b/contrib/tools/python3/src/Lib/copy.py
index 1b276afe081..da2908ef623 100644
--- a/contrib/tools/python3/src/Lib/copy.py
+++ b/contrib/tools/python3/src/Lib/copy.py
@@ -56,11 +56,6 @@ class Error(Exception):
pass
error = Error # backward compatibility
-try:
- from org.python.core import PyStringMap
-except ImportError:
- PyStringMap = None
-
__all__ = ["Error", "copy", "deepcopy"]
def copy(x):
@@ -106,13 +101,11 @@ _copy_dispatch = d = {}
def _copy_immutable(x):
return x
-for t in (type(None), int, float, bool, complex, str, tuple,
+for t in (types.NoneType, int, float, bool, complex, str, tuple,
bytes, frozenset, type, range, slice, property,
- types.BuiltinFunctionType, type(Ellipsis), type(NotImplemented),
- types.FunctionType, weakref.ref):
- d[t] = _copy_immutable
-t = getattr(types, "CodeType", None)
-if t is not None:
+ types.BuiltinFunctionType, types.EllipsisType,
+ types.NotImplementedType, types.FunctionType, types.CodeType,
+ weakref.ref):
d[t] = _copy_immutable
d[list] = list.copy
@@ -120,9 +113,6 @@ d[dict] = dict.copy
d[set] = set.copy
d[bytearray] = bytearray.copy
-if PyStringMap is not None:
- d[PyStringMap] = PyStringMap.copy
-
del d, t
def deepcopy(x, memo=None, _nil=[]):
@@ -181,9 +171,9 @@ _deepcopy_dispatch = d = {}
def _deepcopy_atomic(x, memo):
return x
-d[type(None)] = _deepcopy_atomic
-d[type(Ellipsis)] = _deepcopy_atomic
-d[type(NotImplemented)] = _deepcopy_atomic
+d[types.NoneType] = _deepcopy_atomic
+d[types.EllipsisType] = _deepcopy_atomic
+d[types.NotImplementedType] = _deepcopy_atomic
d[int] = _deepcopy_atomic
d[float] = _deepcopy_atomic
d[bool] = _deepcopy_atomic
@@ -231,8 +221,6 @@ def _deepcopy_dict(x, memo, deepcopy=deepcopy):
y[deepcopy(key, memo)] = deepcopy(value, memo)
return y
d[dict] = _deepcopy_dict
-if PyStringMap is not None:
- d[PyStringMap] = _deepcopy_dict
def _deepcopy_method(x, memo): # Copy instance methods
return type(x)(x.__func__, deepcopy(x.__self__, memo))
@@ -301,4 +289,4 @@ def _reconstruct(x, memo, func, args,
y[key] = value
return y
-del types, weakref, PyStringMap
+del types, weakref