diff options
author | Guido van Rossum <guido@python.org> | 2006-05-26 19:12:38 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-05-26 19:12:38 +0000 |
commit | 0d99a69f3ac9a86a8bbf6255e299ecba8f9dd854 (patch) | |
tree | 67c2354e2f1b0f39da36a5d4e3adfd35f0af74b3 /Lib/copy.py | |
parent | 128b05a3821b8d020be24d1f3260b00b4da0c637 (diff) | |
download | cpython-0d99a69f3ac9a86a8bbf6255e299ecba8f9dd854.tar.gz |
SF patch 1495675: Remove types.InstanceType and new.instance
(Collin Winter)
Diffstat (limited to 'Lib/copy.py')
-rw-r--r-- | Lib/copy.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/Lib/copy.py b/Lib/copy.py index 35c666f7dc..f9e403d478 100644 --- a/Lib/copy.py +++ b/Lib/copy.py @@ -119,26 +119,6 @@ def _copy_with_copy_method(x): if PyStringMap is not None: d[PyStringMap] = _copy_with_copy_method -def _copy_inst(x): - if hasattr(x, '__copy__'): - return x.__copy__() - if hasattr(x, '__getinitargs__'): - args = x.__getinitargs__() - y = x.__class__(*args) - else: - y = _EmptyClass() - y.__class__ = x.__class__ - if hasattr(x, '__getstate__'): - state = x.__getstate__() - else: - state = x.__dict__ - if hasattr(y, '__setstate__'): - y.__setstate__(state) - else: - y.__dict__.update(state) - return y -d[types.InstanceType] = _copy_inst - del d def deepcopy(x, memo=None, _nil=[]): @@ -273,29 +253,6 @@ def _keep_alive(x, memo): # aha, this is the first one :-) memo[id(memo)]=[x] -def _deepcopy_inst(x, memo): - if hasattr(x, '__deepcopy__'): - return x.__deepcopy__(memo) - if hasattr(x, '__getinitargs__'): - args = x.__getinitargs__() - args = deepcopy(args, memo) - y = x.__class__(*args) - else: - y = _EmptyClass() - y.__class__ = x.__class__ - memo[id(x)] = y - if hasattr(x, '__getstate__'): - state = x.__getstate__() - else: - state = x.__dict__ - state = deepcopy(state, memo) - if hasattr(y, '__setstate__'): - y.__setstate__(state) - else: - y.__dict__.update(state) - return y -d[types.InstanceType] = _deepcopy_inst - def _reconstruct(x, info, deep, memo=None): if isinstance(info, str): return x |