473,289 Members | 1,810 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,289 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 1365

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: ‘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
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.