diff Modules/_sqlite/statement.c @ 37938:7da4af95ebad legacy-trunk

Updated the sqlite3 module to the external pysqlite 2.2.2 version.
author Gerhard Häring <gh@ghaering.de>
date Sun, 23 Apr 2006 15:24:26 +0000
parents 96addaa25869
children 52bbe3365c72 b9d4ced23506
line wrap: on
line diff
--- a/Modules/_sqlite/statement.c	Sun Apr 23 15:14:37 2006 +0000
+++ b/Modules/_sqlite/statement.c	Sun Apr 23 15:24:26 2006 +0000
@@ -64,6 +64,7 @@
         return rc;
     }
 
+    self->in_weakreflist = NULL;
     self->sql = sql_str;
 
     sql_cstr = PyString_AsString(sql_str);
@@ -304,6 +305,10 @@
 
     Py_XDECREF(self->sql);
 
+    if (self->in_weakreflist != NULL) {
+        PyObject_ClearWeakRefs((PyObject*)self);
+    }
+
     self->ob_type->tp_free((PyObject*)self);
 }
 
@@ -398,12 +403,12 @@
         0,                                              /* tp_getattro */
         0,                                              /* tp_setattro */
         0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT,                             /* tp_flags */
+        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,  /* tp_flags */
         0,                                              /* tp_doc */
         0,                                              /* tp_traverse */
         0,                                              /* tp_clear */
         0,                                              /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
+        offsetof(Statement, in_weakreflist),            /* tp_weaklistoffset */
         0,                                              /* tp_iter */
         0,                                              /* tp_iternext */
         0,                                              /* tp_methods */