[Python-Dev] deepcopy

Walter Bender bender at physik.rwth-aachen.de
Fri Jun 27 12:14:03 CEST 2008


<mailto:python-dev at python.org>Hello togehter,

I get an error while doing a deep copy of an "event". An event is an 
object, with has a lot of __dict__["attr"]  = Event("SAMPLE") OTHER 
Events added to the object (no self refence) and store additional 
__dict__["attr2"] =  2 informations.
 
deep copy is failing with no proper error message.


    nevent = copy.deepcopy(event);
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 174, in deepcopy
    y = copier(x, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 305, in _deepcopy_inst
    state = deepcopy(state, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 174, in deepcopy
    y = copier(x, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 268, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 174, in deepcopy
    y = copier(x, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 241, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 174, in deepcopy
    y = copier(x, memo)
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 241, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File 
"/net/software_cms/slc4_ia32_gcc345/external/python/2.4.2-CMS3q/lib/python2.4/copy.py", 
line 185, in deepcopy
    y = copier(x, memo)
TypeError: __deepcopy__() takes no arguments (1 given

cheers,
Walter

-- 
Walter Bender
bender at physik.rwth-aachen.de
RWTH Aachen
III. Physikalisches Institut A
Tel. +49-241-8027286



More information about the Python-Dev mailing list