[Python-Dev] Iterating generator from C (PostgreSQL's pl/python RETUN SETOF/RECORD iterator support broken on RedHat buggy libs)

Hannu Krosing hannu at tm.ee
Wed May 31 16:17:18 CEST 2006


Ühel kenal päeval, P, 2006-05-28 kell 14:18, kirjutas Thomas Wouters:
> 
> On 5/20/06, Hannu Krosing <hannu at tm.ee> wrote:
>         I try to move this to -dev as I hope there more people reading
>         it who
>         are competent in internal working :). So please replay to -dev
>         only.
> 
> I'm not sure if you have found the problem on another mailinglist
> then, but I saw no answers on python-dev. 
> 
> 
>         -------------
>         
>         The question is about use of generators in embedde v2.4 with
>         asserts 
>         enabled.
>         
>         Can somebody explain, why the code in try2.c works with
>         wrappers 2 and 3
>         but crashes on buggy exception for all others, that is pure
>         generator
>         and wrappers 1,4,5 ?
> 
> Your example code does not crash for me, not for any of the
> 'wrapper_source' variants, linking against Python 2.4 (debian's python
> 2.4.3 on amd64, both in 64-bit and 32-bit mode) or Python 2.5 (current
> trunk, same hardware.) I don't know what kind of crash you were
> expecting, but I do see unchecked return values, which can cause
> crashes for the simplest of reasons ;-) 

Fedora Core distributes its python libs with asserts on, and this code
triggers an assert, both without a wrapper and with most wrappers

[hannu at lap plpython]$ ./try2
one
try2: Objects/genobject.c:53: gen_iternext: Assertion `f->f_back !=
((void *)0)' failed.
Aborted

This is reported to be fixed for 2.5 (they changed the assert), but I'd
like to have a workaround which would not trigger the old buggy assert.

> -- 
> Thomas Wouters <thomas at python.org>
> 
> Hi! I'm a .signature virus! copy me into your .signature file to help
> me spread!


More information about the Python-Dev mailing list