[Cython] Broken C-API generation for ext modules

Lisandro Dalcin dalcinl at gmail.com
Fri Feb 24 16:07:12 CET 2012

On 24 February 2012 08:00, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Lisandro Dalcin, 23.02.2012 22:00:
>> The commit below from Stefan broke C-API generation for extension
>> modules. The problem is that the code of __Pyx_ImportModule() and
>> __Pyx_ImportType() depeds on the #definition of
>> __Pyx_PyIdentifier_FromString , and such #define is not emitted in
>> C-API headers.
>> Stefan, given that __Pyx_PyIdentifier_FromString() is only used in
>> __Pyx_ImportModule() and __Pyx_ImportType(), what's your opinion about
>> just rolling back your commit?
>> commit 500f9a40f5ad441c2c204d076cfc4f82a41d531b
>> Author: Stefan Behnel
>> Date:   Sat Sep 10 00:14:05 2011 +0200
> That's impressively old for a broken feature.

Indeed. I do not test for this feature on a regular basis in my
projects, and I've been using latest Cython release in production

>>     minor code simplification in utility functions by using macro for
>> Py2/3 dependent PyString/PyUnicode_FromString() calls
> https://github.com/cython/cython/commit/5a31a3d8d38d9d266886916432f1ebe621a2bc69
> I pushed a fix here. Looks like the capi tests didn't detect this, though...

Thanks, I've improved the tests here:

BTW, if you run

$ python runtests.py --no-cleanup module_api

and next look at the generated api header:

$ emacs BUILD/build/module_api/a_api.h

you will notice that there are a lot of blank lines between groups of
declarations and definitions. I guess this originates at
UtilityCodeBase.load_utilities_from_file(), but could not figure out
how to fix it... could you take a look?

Lisandro Dalcin
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

More information about the cython-devel mailing list