Iterating generator from C
Sven Suursoho
sven at spam.pri.ee
Mon May 15 10:20:51 EDT 2006
Mon, 15 May 2006 16:53:12 +0300, Christian Tismer <tismer at stackless.com>:
>> I am working on project that has embedded python interpreter to run
>> user-specified python procedures. Those procedures might return any
>> iterable object with set of result data -- basically everything for
>> which iter() returns valid object (list, tuple, dict, iterator etc)
>> It works ok, except generator under Python 2.4 with debugging enabled
>> (see
>> http://sourceforge.net/tracker/index.php?func=detail&aid=1483133&group_id=5470&atid=105470).
>> Is there any way to rewrite following program to handle returned
>> generator without hitting this bug?
>
> I found this bug as well, and I think the fix should be
> back-ported.
> This problem can only show up when you are comiling a C
> extension, anyway.
> Why don't you just apply the fix and compile your own?
> It is just a wrong assertion, anyway.
Unfortunately, this is not an option because I can't control used
environment: I'm trying to improve PostgreSQL's stored procedure language
PL/Python and this software can be used everywhere.
At first I tried to block using generators if Py_DEBUG is defined. But
this wouldn't work because of another, overlapping bug in Fedora Core 4's
RPM packaging system (didn't check other versions) -- it disables Py_DEBUG
but strips -DNDEBUG from compiler's command-line i.e. no Py_DEBUG and
still active asserts().
See:
http://archives.postgresql.org/pgsql-patches/2006-05/msg00042.php
http://archives.postgresql.org/pgsql-patches/2006-05/msg00105.php
--
Sven Suursoho
More information about the Python-list
mailing list