[Python-bugs-list] [ python-Bugs-592567 ] Bug with deepcopy and new style objects

noreply@sourceforge.net noreply@sourceforge.net
Thu, 08 Aug 2002 20:43:56 -0700


Bugs item #592567, was opened at 2002-08-08 07:42
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592567&group_id=5470

Category: Python Library
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Jiba (jiba)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug with deepcopy and new style objects

Initial Comment:
Deepcopying new style objects can bug if more than one
of such objects are deep copied at the same time (E.g.
you are deepcopying a list of two new style objects).

It seems that , in copy._reconstruct, the "state" 
variable should be "kept alive" (by passing it to the
"_keep_alive" function), since this state may be gc'ed,
and another state may be created later with the same
address memory / ID.

BTW, the same problem may arise with the "args"
variable, in the same function.

The included file demonstrates the bug.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-08-08 22:43

Message:
Logged In: YES 
user_id=80475

Confirmed on 2.2.1 and 2.3a:

Before deepcopying :
[11, 12, 13]
[21, 22, 23]
[31, 32, 33]

After deepcopying :
[11, 12, 13]
[11, 12, 13]
[11, 12, 13]


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592567&group_id=5470