zope.copy.copy() copies __parent__ before discarding it

Bug #692280 reported by Marius Gedminas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.copy
New
Undecided
Unassigned

Bug Description

zope.copy.copy() does

    new = clone(obj)
    new.__parent__ = None

in that order, which means __parent__ and everything reachable from it (which is more or less the entire ZODB, if your objects have __parent__ references) are first copied and then discarded.

That assumes those objects can be copied, which is not always the case:
https://mail.zope.org/pipermail/zope-dev/2010-December/042202.html

How about making pickler.persistent_id in zope.copy.clone() check the object against a blacklist before passing it on to persistent.id? The blacklist could be an argument to clone(), and copy() would pass obj.__parent__ to it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.