[ZODB-Dev] [ zodb-Patches-653356 ] ZClass Heisenbug
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 13 Dec 2002 09:31:55 -0800
Patches item #653356, was opened at 2002-12-13 12:31
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=315628&aid=653356&group_id=15628
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Shane Hathaway (hathawsh)
Assigned to: Nobody/Anonymous (nobody)
Summary: ZClass Heisenbug
Initial Comment:
ZClasses are not being pickled correctly.
>From Evan Simpson on zope-dev:
"""
I copied the commented-out Python persistent_id() in
ZODB/Connections.py into a method called
test_persistent_id(), and compared its results with
coptimizations' new_persistent_id. They matched for
everything except _zclass_ objects, for which
test_persistent_id returned the _p_oid and
new_persistent_id returned None. I have no idea why
this is. It would explain why the _zclass_es are
stored wrongly, but not why everyone else isn't seeing
major breakage.
"""
The problem is that the new get_class() function in
coptimizations.c returns NULL if the object is an
ExtensionClass, leading persistent_id_call() to
immediately return None. The old code behaved
differently, returning an OID for the special case of
ZClasses.
A patch is attached. I also created a test case that
could be converted into a unit test, which I will add
in a second comment.
The patch might not be optimal, since at the point
being patched, the class of the object is theoretically
guaranteed to be PyExtensionClass. But I couldn't find
a way to get at that object in C without crude hacks,
so I resorted to getting the class attribute.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=315628&aid=653356&group_id=15628