diff --git a/psycopg2-backport-refleaks.patch b/psycopg2-backport-refleaks.patch new file mode 100644 index 0000000..25df144 --- /dev/null +++ b/psycopg2-backport-refleaks.patch @@ -0,0 +1,43 @@ +@@ -, +, @@ + psycopg/typecast.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) +--- a/psycopg/typecast.c ++++ a/psycopg/typecast.c +@@ -381,9 +381,12 @@ typecast_dealloc(PyObject *obj) + { + typecastObject *self = (typecastObject*)obj; + ++ PyObject_GC_UnTrack(self); ++ + Py_CLEAR(self->values); + Py_CLEAR(self->name); + Py_CLEAR(self->pcast); ++ Py_CLEAR(self->bcast); + + obj->ob_type->tp_free(obj); + } +@@ -396,6 +399,7 @@ typecast_traverse(PyObject *obj, visitproc visit, void *arg) + Py_VISIT(self->values); + Py_VISIT(self->name); + Py_VISIT(self->pcast); ++ Py_VISIT(self->bcast); + return 0; + } + +@@ -587,7 +591,7 @@ typecast_cast(PyObject *obj, const char *str, Py_ssize_t len, PyObject *curs) + PyObject *old, *res = NULL; + typecastObject *self = (typecastObject *)obj; + +- /* we don't incref, the caster *can't* die at this point */ ++ Py_INCREF(obj); + old = ((cursorObject*)curs)->caster; + ((cursorObject*)curs)->caster = obj; + +@@ -602,6 +606,7 @@ typecast_cast(PyObject *obj, const char *str, Py_ssize_t len, PyObject *curs) + } + + ((cursorObject*)curs)->caster = old; ++ Py_DECREF(obj); + + return res; + } diff --git a/python-psycopg2.spec b/python-psycopg2.spec index ee15608..451babe 100644 --- a/python-psycopg2.spec +++ b/python-psycopg2.spec @@ -8,13 +8,15 @@ Summary: A PostgreSQL database adapter for Python Name: python-psycopg2 Version: 2.0.14 -Release: 1%{?dist} +Release: 2%{?dist} Source0: http://initd.org/pub/software/psycopg/psycopg2-%{version}.tar.gz +# Backport to fix https://bugzilla.redhat.com/show_bug.cgi?id=757302 +Patch0: psycopg2-backport-refleaks.patch License: GPL (with Exceptions) Group: Applications/Databases BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Url: http://www.initd.org/software/initd/psycopg -BuildRequires: python-devel postgresql-devel +BuildRequires: python2-devel postgresql-devel Requires: postgresql-libs %description @@ -43,6 +45,7 @@ Zope Database Adapter for PostgreSQL, called ZPsycopgDA %prep %setup -q -n psycopg2-%{version} +%patch0 -p0 -b .refleaks %build python setup.py build @@ -84,6 +87,10 @@ rm -rf %{buildroot} %{ZPsycopgDAdir}/icons/* %changelog +* Fri Jul 27 2012 Toshio Kuratomi - 2.0.14-2 +- Add patch to fix reference leaks (slukasik) + https://bugzilla.redhat.com/show_bug.cgi?id=757302 + * Wed Mar 17 2010 Devrim GUNDUZ - 2.0.14-1 - Update to 2.0.14