[Zodb-checkins] CVS: Zope3/src/persistence - persistence.h:1.4 persistence.c:1.14

Jeremy Hylton jeremy at zope.com
Fri Apr 25 16:02:36 EDT 2003


Update of /cvs-repository/Zope3/src/persistence
In directory cvs.zope.org:/tmp/cvs-serv16613/src/persistence

Modified Files:
	persistence.h persistence.c 
Log Message:
Remove _p_serial from the PyPersist_HEAD.

Persistent objects still have an _p_serial attribute, but it is stored
in the instance dict for most objects.  If a specific class doesn't
have an instance dict, it must arrange to store _p_serial somewhere
else.  The BTrees store it in their object structs.

The change reduces the __basicsize__ of all persistent objects by 4
bytes, which saves 8 bytes in practice because of obmalloc rounding.

One consequence of this change is that objects don't have an _p_serial
== None at creation time.  Two tests depended on that.


=== Zope3/src/persistence/persistence.h 1.3 => 1.4 ===
--- Zope3/src/persistence/persistence.h:1.3	Fri Apr 25 12:39:37 2003
+++ Zope3/src/persistence/persistence.h	Fri Apr 25 15:02:35 2003
@@ -35,7 +35,6 @@
     PyObject_HEAD \
     PyObject *po_dm; \
     PyObject *po_oid; \
-    PyObject *po_serial; \
     int po_atime; \
     enum PyPersist_State po_state;
 


=== Zope3/src/persistence/persistence.c 1.13 => 1.14 ===
--- Zope3/src/persistence/persistence.c:1.13	Thu Apr 17 14:38:53 2003
+++ Zope3/src/persistence/persistence.c	Fri Apr 25 15:02:35 2003
@@ -621,7 +621,6 @@
 {
     Py_XDECREF(self->po_dm);
     Py_XDECREF(self->po_oid);
-    Py_XDECREF(self->po_serial);
     PyObject_GC_Del(self);
 }
 
@@ -638,7 +637,6 @@
     }
     VISIT(self->po_dm);
     VISIT(self->po_oid);
-    VISIT(self->po_serial);
 #undef VISIT
     return 0;
 }
@@ -648,10 +646,8 @@
 {
     Py_XDECREF(self->po_dm);
     Py_XDECREF(self->po_oid);
-    Py_XDECREF(self->po_serial);
     self->po_dm = NULL;
     self->po_oid = NULL;
-    self->po_serial = NULL;
     return 0;
 }
 
@@ -722,7 +718,6 @@
 static PyMemberDef persist_members[] = {
     {"_p_jar", T_OBJECT, offsetof(PyPersistObject, po_dm)},
     {"_p_oid", T_OBJECT, offsetof(PyPersistObject, po_oid)},
-    {"_p_serial", T_OBJECT, offsetof(PyPersistObject, po_serial)},
     {"_p_atime", T_INT, offsetof(PyPersistObject, po_atime)},
     {"_p_state", T_INT, offsetof(PyPersistObject, po_state), RO},
     {NULL}




More information about the Zodb-checkins mailing list