[Stackless-checkins] CVS: slpdev/src/2.2/src/Lib copy.py,1.3,1.4
Christian Tismer
tismer at centera.de
Sat May 1 00:11:31 CEST 2004
- Previous message: [Stackless-checkins] CVS: slpdev/src/2.2/src/PCbuild _socket.dsp, 1.3, 1.4 _sre.dsp, 1.4, 1.5 _symtable.dsp, 1.3, 1.4 _testcapi.dsp, 1.3, 1.4 _tkinter.dsp, 1.6, 1.7 bsddb.dsp, 1.3, 1.4
- Next message: [Stackless-checkins] CVS: slpdev/src/2.2/src/Lib/distutils/command bdist_rpm.py, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/slpdev/src/2.2/src/Lib
In directory centera.de:/tmp/cvs-serv13270/src/Lib
Modified Files:
copy.py
Log Message:
checking Python 2.2.3 back in, almost unmodified.
The only modifications are in PCbuild, and the additon of the
new Stackless for 2.3.3 trunk.
Purpose: I will apply all current changes to 2.3.3 back to 2.2.3.
Since I'm unsure how to do this on the current dev trunk by CVS,
and since I never imported 2.2.3 before, I prefer to do it this
way, using the merge program explicitly.
Index: copy.py
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Lib/copy.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** copy.py 29 Nov 2003 22:06:36 -0000 1.3
--- copy.py 30 Apr 2004 22:11:27 -0000 1.4
***************
*** 165,182 ****
except KeyError:
try:
! copier = x.__deepcopy__
! except AttributeError:
try:
! reductor = x.__reduce__
except AttributeError:
! raise error, \
! "un-deep-copyable object of type %s" % type(x)
else:
! y = _reconstruct(x, reductor(), 1)
! else:
! y = copier(memo)
else:
y = copierfunction(x, memo)
memo[d] = y
return y
--- 165,190 ----
except KeyError:
try:
! issc = issubclass(type(x), type)
! except TypeError:
! issc = 0
! if issc:
! y = _deepcopy_dispatch[type](x, memo)
! else:
try:
! copier = x.__deepcopy__
except AttributeError:
! try:
! reductor = x.__reduce__
! except AttributeError:
! raise error, \
! "un-deep-copyable object of type %s" % type(x)
! else:
! y = _reconstruct(x, reductor(), 1, memo)
else:
! y = copier(memo)
else:
y = copierfunction(x, memo)
memo[d] = y
+ _keep_alive(x, memo) # Make sure x lives at least as long as d
return y
***************
*** 198,202 ****
except AttributeError:
pass
! d[types.CodeType] = _deepcopy_atomic
d[types.TypeType] = _deepcopy_atomic
d[types.XRangeType] = _deepcopy_atomic
--- 206,213 ----
except AttributeError:
pass
! try:
! d[types.CodeType] = _deepcopy_atomic
! except AttributeError:
! pass
d[types.TypeType] = _deepcopy_atomic
d[types.XRangeType] = _deepcopy_atomic
***************
*** 260,264 ****
if hasattr(x, '__getinitargs__'):
args = x.__getinitargs__()
- _keep_alive(args, memo)
args = deepcopy(args, memo)
y = apply(x.__class__, args)
--- 271,274 ----
***************
*** 269,273 ****
if hasattr(x, '__getstate__'):
state = x.__getstate__()
- _keep_alive(state, memo)
else:
state = x.__dict__
--- 279,282 ----
***************
*** 280,287 ****
d[types.InstanceType] = _deepcopy_inst
! def _reconstruct(x, info, deep):
if isinstance(info, str):
return x
assert isinstance(info, tuple)
n = len(info)
assert n in (2, 3)
--- 289,298 ----
d[types.InstanceType] = _deepcopy_inst
! def _reconstruct(x, info, deep, memo=None):
if isinstance(info, str):
return x
assert isinstance(info, tuple)
+ if memo is None:
+ memo = {}
n = len(info)
assert n in (2, 3)
***************
*** 292,301 ****
state = {}
if deep:
! args = deepcopy(args)
y = callable(*args)
if state:
if deep:
! state = deepcopy(state)
! y.__dict__.update(state)
return y
--- 303,315 ----
state = {}
if deep:
! args = deepcopy(args, memo)
y = callable(*args)
if state:
if deep:
! state = deepcopy(state, memo)
! if hasattr(y, '__setstate__'):
! y.__setstate__(state)
! else:
! y.__dict__.update(state)
return y
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
- Previous message: [Stackless-checkins] CVS: slpdev/src/2.2/src/PCbuild _socket.dsp, 1.3, 1.4 _sre.dsp, 1.4, 1.5 _symtable.dsp, 1.3, 1.4 _testcapi.dsp, 1.3, 1.4 _tkinter.dsp, 1.6, 1.7 bsddb.dsp, 1.3, 1.4
- Next message: [Stackless-checkins] CVS: slpdev/src/2.2/src/Lib/distutils/command bdist_rpm.py, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Stackless-checkins
mailing list