[Zope3-checkins] CVS: Zope3/src/persistence - persistence.c:1.7

Tim Peters tim.one@comcast.net
Fri, 21 Mar 2003 16:03:08 -0500


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

Modified Files:
	persistence.c 
Log Message:
persist_reduce():  This obviously intended to declare the local
__getstate__str as static, but forgot to.  As a result, it created,
over time, an unbounded number of references to the interned
Python string object holding "__getstate__" (it leaked another reference
to that string on each call).

Fixing this should also have sped the function.


=== Zope3/src/persistence/persistence.c 1.6 => 1.7 ===
--- Zope3/src/persistence/persistence.c:1.6	Thu Mar  6 14:08:16 2003
+++ Zope3/src/persistence/persistence.c	Fri Mar 21 16:03:07 2003
@@ -619,7 +619,8 @@
 persist_reduce(PyPersistObject *self)
 {
     PyObject *state, *args=NULL, *result, *__getstate__;
-    PyObject *__getstate__str = NULL;
+
+    static PyObject *__getstate__str = NULL;
   
     if (! __getstate__str) {
 	__getstate__str = PyString_InternFromString("__getstate__");