diff options
author | Guido van Rossum <guido@python.org> | 2003-02-19 01:58:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-02-19 01:58:53 (GMT) |
commit | f805cd2c1f4d850b1d933f39e63a61a3348ec224 (patch) | |
tree | 62cff636752c483b79edaac8428ca7190b557874 /Lib/copy_reg.py | |
parent | b289b87a375297cf86d453e6696db48f3ce91620 (diff) | |
download | cpython-f805cd2c1f4d850b1d933f39e63a61a3348ec224.zip cpython-f805cd2c1f4d850b1d933f39e63a61a3348ec224.tar.gz cpython-f805cd2c1f4d850b1d933f39e63a61a3348ec224.tar.bz2 |
Rename _better_reduce to _reduce_2, to make sure that any code that
was still referencing it will fail. Also removed some debug cruft
from _reduce_ex.
Diffstat (limited to 'Lib/copy_reg.py')
-rw-r--r-- | Lib/copy_reg.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index fcef409..20e7bcf 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -80,7 +80,7 @@ def _reduce(self): def __newobj__(cls, *args): return cls.__new__(cls, *args) -def _better_reduce(obj): +def _reduce_2(obj): cls = obj.__class__ getnewargs = getattr(obj, "__getnewargs__", None) if getnewargs: @@ -113,17 +113,12 @@ def _better_reduce(obj): def _reduce_ex(obj, proto=0): obj_reduce = getattr(obj, "__reduce__", None) - # XXX This fails in test_copy.py line 61 - if obj_reduce: - try: - if obj.__class__.__reduce__ is not object.__reduce__: - return obj_reduce() - except AttributeError: - pass - if proto < 2: + if obj_reduce and obj.__class__.__reduce__ is not object.__reduce__: + return obj_reduce() + elif proto < 2: return _reduce(obj) else: - return _better_reduce(obj) + return _reduce_2(obj) def _slotnames(cls): """Return a list of slot names for a given class. |