pyximport and distutils directives

42 views
Skip to first unread message

Antony Lee

unread,
Jun 5, 2015, 4:57:57 AM6/5/15
to cython...@googlegroups.com
I *believe* that pyximport is not obeying distutils directives at the top of a pyx file.

Examples:

#distutils: language=c++
cdef extern from "<cmath>":
    T fabs[T](T)
def f(x):
    return fabs(x)
==> fails to compile as it calls gcc instead of g++

#distutils: undef_macros=NDEBUG
cdef extern from "assert.h":
    void cassert "assert"(bint)
def g():
    cassert(0)
==> g() does not lead to an assertion failure.

While pyxbld files could help, I feel putting everything in a single file is easier to maintain (and they aren't even mentioned in the Cython docs).

Antony

Björn Dahlgren

unread,
Jun 7, 2015, 10:09:52 AM6/7/15
to cython...@googlegroups.com


On Friday, 5 June 2015 10:57:57 UTC+2, Antony Lee wrote:
I *believe* that pyximport is not obeying distutils directives at the top of a pyx file.

You are correct, you might have seen:
https://groups.google.com/forum/#!topic/cython-users/VIQ5QH2xke8

I'm not using pyximport any more so I never got around patching it.

Best regards,
Björn
Reply all
Reply to author
Forward
0 new messages