diff options
author | Guido van Rossum <guido@python.org> | 2006-05-26 19:12:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-05-26 19:12:38 (GMT) |
commit | 65810fee5e961af07fb964252b794c67162f98ee (patch) | |
tree | 7400532588af74faa31a12c31492839ab2e06c9a /Lib/copy.py | |
parent | 2018831b2b2106499a43b37e49e24f7f14154d35 (diff) | |
download | cpython-65810fee5e961af07fb964252b794c67162f98ee.zip cpython-65810fee5e961af07fb964252b794c67162f98ee.tar.gz cpython-65810fee5e961af07fb964252b794c67162f98ee.tar.bz2 |
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 35c666f..f9e403d 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 |