473,511 Members | 15,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1373

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

Similar topics

2
1494
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
3947
by: ‘5ÛHH575-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
2218
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
1334
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
3095
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
1669
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
2202
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
3656
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
2092
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
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7371
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,...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.