Commit 47dc7992 authored by Jim Fulton's avatar Jim Fulton

Fixed bug due to use of (moral equivalent of) type, rather than

.__class__.   This caused acquisition wrappers to get pickled. :(
parent 7af1505c
...@@ -92,7 +92,7 @@ static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;} ...@@ -92,7 +92,7 @@ static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;}
#define OBJECT(O) ((PyObject*)(O)) #define OBJECT(O) ((PyObject*)(O))
static PyObject *py__p_oid, *py__p_jar, *py___getinitargs__, *py___module__; static PyObject *py__p_oid, *py__p_jar, *py___getinitargs__, *py___module__;
static PyObject *py_new_oid; static PyObject *py_new_oid, *py___class__;
typedef struct { typedef struct {
...@@ -144,14 +144,22 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs) ...@@ -144,14 +144,22 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
*/ */
/* Filter out most objects with low-level test. Yee ha! */ /* Filter out most objects with low-level test.
UNLESS (PyExtensionClass_Check(object) Yee ha!
|| (Also get klass along the way.)
(PyExtensionInstance_Check(object) && */
(((PyExtensionClass*)(object->ob_type))->class_flags if (! PyExtensionClass_Check(object))
if (PyExtensionInstance_Check(object))
{
UNLESS (klass=PyObject_GetAttr(object, py___class__)) return NULL;
UNLESS (
PyExtensionClass_Check(klass) &&
(((PyExtensionClass*)klass)->class_flags
& PERSISTENT_TYPE_FLAG) & PERSISTENT_TYPE_FLAG)
) )
) goto not_persistent;
}
else
goto not_persistent; goto not_persistent;
UNLESS (oid=PyObject_GetAttr(object, py__p_oid)) UNLESS (oid=PyObject_GetAttr(object, py__p_oid))
...@@ -203,7 +211,6 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs) ...@@ -203,7 +211,6 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
if hasattr(klass, '__getinitargs__'): return oid if hasattr(klass, '__getinitargs__'): return oid
*/ */
klass=OBJECT(object->ob_type);
if ((r=PyObject_GetAttr(klass, py___getinitargs__))) if ((r=PyObject_GetAttr(klass, py___getinitargs__)))
{ {
Py_DECREF(r); Py_DECREF(r);
...@@ -299,13 +306,14 @@ void ...@@ -299,13 +306,14 @@ void
initcoptimizations() initcoptimizations()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.1 $"; char *rev="$Revision: 1.2 $";
#define make_string(S) if (! (py_ ## S=PyString_FromString(#S))) return #define make_string(S) if (! (py_ ## S=PyString_FromString(#S))) return
make_string(_p_oid); make_string(_p_oid);
make_string(_p_jar); make_string(_p_jar);
make_string(__getinitargs__); make_string(__getinitargs__);
make_string(__module__); make_string(__module__);
make_string(__class__);
make_string(new_oid); make_string(new_oid);
UNLESS (ExtensionClassImported) return; UNLESS (ExtensionClassImported) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment