[Python-checkins] python/dist/src/Lib copy_reg.py,1.22,1.23
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Tue, 18 Feb 2003 17:58:56 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv6456
Modified Files:
copy_reg.py
Log Message:
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.
Index: copy_reg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** copy_reg.py 19 Feb 2003 01:19:27 -0000 1.22
--- copy_reg.py 19 Feb 2003 01:58:53 -0000 1.23
***************
*** 81,85 ****
return cls.__new__(cls, *args)
! def _better_reduce(obj):
cls = obj.__class__
getnewargs = getattr(obj, "__getnewargs__", None)
--- 81,85 ----
return cls.__new__(cls, *args)
! def _reduce_2(obj):
cls = obj.__class__
getnewargs = getattr(obj, "__getnewargs__", None)
***************
*** 114,128 ****
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:
return _reduce(obj)
else:
! return _better_reduce(obj)
def _slotnames(cls):
--- 114,123 ----
def _reduce_ex(obj, proto=0):
obj_reduce = getattr(obj, "__reduce__", None)
! if obj_reduce and obj.__class__.__reduce__ is not object.__reduce__:
! return obj_reduce()
! elif proto < 2:
return _reduce(obj)
else:
! return _reduce_2(obj)
def _slotnames(cls):