Re: [PATCH] Fix refcounting bug in typecaster

Michael Tharp <gxti-1pawZKhx9Om5WRpDikjj11aTQe2KTcn/@public.gmane.org> Thu, 08 Apr 2010 13:29:20 -0400
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 04/08/2010 12:24 PM, Federico Di Gregorio wrote:
> I created a test case out of your example code but my psycopg2 on Python
> 2.5 passes the test here. Can you please run the test and confirm that
> it shows the problem? Test code attached to this email.
>
> federico
>

Confirmed on 2.4.4 and 2.6.2, the latter being Fedora 12 x86_64

gxti@eureka ~/code/public/psycopg2 $ git reset --hard HEAD
HEAD is now at 0a33ed0 Added test for refcounting/gc bug reported by 
Michael Tharp
gxti@eureka ~/code/public/psycopg2 $ vi tests/__init__.py
gxti@eureka ~/code/public/psycopg2 $ python setup.py -q clean -a build
[...]
gxti@eureka ~/code/public/psycopg2 $ python runtests.py tests.bug_gc
python: Modules/gcmodule.c:277: visit_decref: Assertion `gc->gc.gc_refs 
!= 0' failed.
Aborted (core dumped)



gxti@eureka ~/code/public/psycopg2 $ git checkout bug_gc
gxti@eureka ~/code/public/psycopg2 $ python setup.py -q clean -a build
[...]
gxti@eureka ~/code/public/psycopg2 $ python runtests.py tests.bug_gc
.
----------------------------------------------------------------------
Ran 1 test in 0.009s

OK

Note that I had to add a new compatibility macro after d339466c due to 
the use of PyInt_FromSsize_t, I will address this in a separate email.

-- m. tharp