[Numpy-discussion] Updating cython directory to pxd usage: objections?
Fri Jun 20 12:51:53 CDT 2008
On Thu, Jun 19, 2008 at 9:18 PM, Fernando Perez <firstname.lastname@example.org> wrote:
> On Thu, Jun 19, 2008 at 5:29 PM, Robert Kern <email@example.com> wrote:
>>> I just tested the changes and there seem to be no ill effects. Should
>>> I go ahead and commit it? I'll do it in a single commit with no other
>>> changes so it's easy to revert should it prove to be a bad idea.
> Thanks. Done in r5301.
Well, the simplistic test script we had in didn't show any problems,
but Matthew Brett was more careful than me and went looking into the
On Fri, Jun 20, 2008 at 1:32 AM, Matthew Brett <firstname.lastname@example.org> wrote:
>>>> I just tested the changes and there seem to be no ill effects. Should
>>>> I go ahead and commit it? I'll do it in a single commit with no other
>>>> changes so it's easy to revert should it prove to be a bad idea.
>> Thanks. Done in r5301.
> Hmm - but does import_array() get called when it's in the pxd file? I
> just updated svn and generated the numpyx.c file, and can't see
> import_array() there. Isn't the pxd file just definitions?
And indeed, it was my fault for not RTFM:
It [the .pxd file] cannot contain the implementations of any C or
Python functions, or any Python class definitions, or **any executable
statements**. (emphasis mine).
I verified further by putting the import_array() back into the .pyx
file and indeed:
- i_a() in .pxd -> missing from .c file.
- i_a() in .pyx -> OK in .c file.
It thus seems that we must keep the import_array call out of the .pxd
and users still need to remember to make it themselves.
I'll go ahead and clean up, since the mess was my fault.
Many thanks to Matthew for catching it!
More information about the Numpy-discussion