[DB-SIG] dbi module patch
Stephen J. Turner
sjturner@ix.netcom.com
Thu, 17 Dec 1998 17:25:42 -0500
This is a multi-part message in MIME format.
--------------4A3D4AB30CDD76090C2CB53A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Attached is a patch for the dbi module. It fixes an obscure little
reference count bug that only surfaces if a dbiRaw object is converted
to string (e.g., via the str function).
Sorry for the direct post to the SIG. I'd have contacted the various
maintainers directly, but I have no idea just how many of the DB-API
implementations might share the same dbi source file (I gave up checking
after informixdb, kinfxdb, oracledb and ctsybase).
--
Stephen J. Turner <sjturner@ix.netcom.com>
--------------4A3D4AB30CDD76090C2CB53A
Content-Type: text/plain; charset=us-ascii; name="dbi.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dbi.patch"
Index: dbi.c
===================================================================
RCS file: /cvsroot/python/informixdb/dbi.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- dbi.c 1998/09/15 17:40:47 1.1.1.1
+++ dbi.c 1998/12/17 16:50:50 1.2
@@ -84,6 +84,13 @@
#endif
}
+static PyObject *rawStr(PyObject *o)
+{
+ PyObject *val = dbiValue(o);
+ Py_INCREF(val);
+ return val;
+}
+
#define delg(a) dbiValue(a)->ob_type->tp_as_number
static PyObject* dt_nb_add(PyObject* a, PyObject* b)
@@ -189,7 +196,7 @@
0, /**tp_as_mapping */
0, /*tp_hash */
0, /*tp_call */
- dbiValue /*tp_str */
+ rawStr /*tp_str */
} ;
static PyTypeObject DbiRowId_Type =
--------------4A3D4AB30CDD76090C2CB53A--