[Zodb-checkins] CVS: Zope/lib/python/ZODB - TimeStamp.c:1.15.60.4

Tim Peters tim.one at comcast.net
Thu Jun 19 18:51:37 EDT 2003


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv17655/lib/python/ZODB

Modified Files:
      Tag: Zope-2_6-branch
	TimeStamp.c 
Log Message:
TimeStamp_laterThan():  This leaked a Python string object whenever it
had to create a new timestamp.  Fixed.

check2ZODBThreads(), check7ZODBThreads():  Close the database when
these tests end.  Else they leak bigtime, obscuring searches for real
leaks.


=== Zope/lib/python/ZODB/TimeStamp.c 1.15.60.3 => 1.15.60.4 ===
--- Zope/lib/python/ZODB/TimeStamp.c:1.15.60.3	Thu Jan 30 18:25:13 2003
+++ Zope/lib/python/ZODB/TimeStamp.c	Thu Jun 19 17:51:06 2003
@@ -222,7 +222,7 @@
 TimeStamp_laterThan(TimeStamp *self, PyObject *args)
 {
   TimeStamp *o=NULL;
-  unsigned char *s;
+  unsigned char s[8];
   PyObject *a;
   int i;
   
@@ -236,9 +236,7 @@
 
   self=o;
 
-  UNLESS(a=PyString_FromStringAndSize((char *) self->data, 8)) return NULL;
-  s=(unsigned char *)PyString_AsString(a);
-  
+  memcpy(s, self->data, 8);
   for (i=7; i > 3; i--) 
     {
       if (s[i] == 255) 
@@ -246,7 +244,8 @@
       else
 	{
 	  s[i]++;
-	  return PyObject_CallFunction(OBJECT(self->ob_type), "O", a);
+	  return PyObject_CallFunction(OBJECT(self->ob_type), "N", 
+	             PyString_FromStringAndSize(s, 8));
 	}
     }
 




More information about the Zodb-checkins mailing list