The following message was sent to my email. Anyone see a problem
implementing this?
Begin forwarded message:
While using PyGreSQL 3.7, I found a small memory leak in the C to
Python conversion for floating point types. I've attached a
patch below.
--
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org
diff -Naurd PyGreSQL-3.7.orig/pgmodule.c PyGreSQL-3.7/pgmodule.c
--- PyGreSQL-3.7.orig/pgmodule.c 2006-02-02 11:47:51.000000000 -0800
+++ PyGreSQL-3.7/pgmodule.c 2006-02-02 11:55:05.000000000 -0800
@@ -1823,6 +1823,7 @@
int k;
char *s = PQgetvalue(self->last_result, i, j);
char cashbuf[64];
+ PyObject *float_str;
if (PQgetisnull(self->last_result, i, j))
{
@@ -1841,7 +1842,10 @@
break;
case 3:
- val =
PyFloat_FromString(PyString_FromString(s), NULL);
+ float_str =
PyString_FromString(s);
+ val =
PyFloat_FromString(float_str, NULL);
+ Py_DECREF(float_str);
+ float_str = NULL;
break;
case 4:
@@ -1945,6 +1949,7 @@
int k;
char *s = PQgetvalue(self->last_result, i, j);
char cashbuf[64];
+ PyObject *float_str;
if (PQgetisnull(self->last_result, i, j))
{
@@ -1963,7 +1968,10 @@
break;
case 3:
- val =
PyFloat_FromString(PyString_FromString(s), NULL);
+ float_str =
PyString_FromString(s);
+ val =
PyFloat_FromString(float_str, NULL);
+ Py_DECREF(float_str);
+ float_str = NULL;
break;
case 4:
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql