473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

deepcopy debugging

I'm using deepcopy in some code which eventually ends up by crash witht he
following rather long winded error. I'm not directly using _hashlib.HASH, but I
suppose something else along the way could be. Is there some nice way to make
copy/deepcopy give more information when this error happens? I know what the top
level object is, but presumably it's something further down that's causing the
problem.

..........

File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 234, in _deepcopy_tuple
y.append(deepcopy(a, memo))
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 227, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 234, in _deepcopy_tuple
y.append(deepcopy(a, memo))
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 234, in _deepcopy_tuple
y.append(deepcopy(a, memo))
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 291, in _deepcopy_inst
state = deepcopy(state, memo)
File "C:\Python\lib\copy.py", line 162, in deepcopy
y = copier(x, memo)
File "C:\Python\lib\copy.py", line 254, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Python\lib\copy.py", line 189, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Python\lib\copy.py", line 322, in _reconstruct
y = callable(*args)
File "C:\Python\lib\copy_reg.py", line 92, in __newobj__
return cls.__new__(cls, *args)
TypeError: object.__new__(_hashlib.HASH) is not safe, use _hashlib.HASH.__new__()
--
Robin Becker

Oct 19 '07 #1
0 1369

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eugeni Doljenko | last post by:
There is a list of custom objects. I want do duplicate this list to modify objects in new list and then compare old and new. I could do it with deepcopy class foo: def __init__(self, str):...
7
by: 5HH575-UAZWKVVP-7H2H48V3 | last post by:
(see end of message for example code) When an instance has a dynamically assigned instance method, deepcopy throws a TypeError with the message "TypeError: instancemethod expected at least 2...
6
by: Alexander Zatvornitskiy | last post by:
Hello! I have trouble with copy/deepcopy. It seems, I just don't understand something. Please explain where things goes wrong and how to do it the right way. I have one class: class...
0
by: phil | last post by:
I wrote the following to prove to myself that deepcopy would copy an entire dictionary which contains an instance of a class to one key of another dictionary. Note that after copying adict to...
6
by: phil | last post by:
I posted the following yesterday and got no response and did some testing simplifying the circumstances and it appears that deepcopy fails when the object to be copied contains a reference to a...
0
by: Joshua Ginsberg | last post by:
Howdy -- I have a class that has an attribute that is a dictionary that contains an object that has a kword argument that is a lambda. Confused yet? Simplified example: import copy class...
7
by: Alexandre Guimond | last post by:
Hi all, i'm trying to deepcopy a slice object but i get the following error. Does anyone know a workaround? ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on Python 2.4.3 (#69,...
4
by: Emin | last post by:
Dear experts, I got some unexpected behavior in getattr and copy.deepcopy (see transcript below). I'm not sure if this is actually a bug in copy.deepcopy or if I'm doing something too magical...
1
by: Wouter DW | last post by:
I read the article on http://www.python.org/download/releases/2.2/descrintro/#metaclasses and started using autoprop. But now I have a problem I can't seem to solve myself. class autoprop(type):...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.