The short answer:
Recompile all your .pyx files again (you can force this by removing
all your .c files) or use a setup like
http://wiki.cython.org/enhancements/distutils_preprocessing that
understands interdependencies.
The long answer:
You have node.pyx, node.pxd, problemreader.pyx. When compiling
problemreader.pyx it looks at node.pxd and uses information about
object struct layouts, etc. to generate the .c file. If you then
modify node.pxd without re-compiling problemreader.pyx the C-level
layout of your Node class can change rendering it incompatible with
problemreader.c. Cython detects this at runtime (when it can) and
trows this value error.
- Robert
Recompile all your .pyx files again (you can force this by removing
all your .c files)
or use a setup like
http://wiki.cython.org/enhancements/distutils_preprocessing that
understands interdependencies.
The long answer:
You have node.pyx, node.pxd, problemreader.pyx. When compiling
problemreader.pyx it looks at node.pxd and uses information about
object struct layouts, etc. to generate the .c file.
If you then
modify node.pxd without re-compiling problemreader.pyx the C-level
layout of your Node class can change rendering it incompatible with
problemreader.c. Cython detects this at runtime (when it can) and
trows this value error.
Removing the .c files should cause it to create new ones as if you did
it manually. Are you sure you didn't have some old object files cached
somewhere? Are you invoking the same version of Cython from setup.py
as you are from the command line?
Hmm... I'll take a look at that. Could you re-post your code so I can
try to reproduce it?
>>
>> The long answer:
>>
>> You have node.pyx, node.pxd, problemreader.pyx. When compiling
>> problemreader.pyx it looks at node.pxd and uses information about
>> object struct layouts, etc. to generate the .c file.
>
> ok
>>
>> If you then
>> modify node.pxd without re-compiling problemreader.pyx the C-level
>> layout of your Node class can change rendering it incompatible with
>> problemreader.c. Cython detects this at runtime (when it can) and
>> trows this value error.
>
> I think this would be much easier to understand if I actually modified
> anything... but the problem occurs on executing the setup script on a
> version without any c etc. files. Everything is generated, then nothing is
> changed and the error still occurs. Would be nice to be able to understand
> this, however I'm happy that I have now one way of creating everything that
> doesn't fail (manually cythonizing the .pyx files and then calling the old
> setup). I guess whatever goes wrong with the new setup script deserves a
> look as well - do you want me to file a bug? [1]
> /gerald
> [1] I couldn't find any related bug on http://trac.cython.org.
Yes, please do.
- Robert
> Doesn't work when removing all .c, .o and .so files and then directly
> calling setup.py afterwards; same issue. Manually cythonizing the pyx files
> first (cython *.pyx) and then calling the old setup works like a charm. :)Removing the .c files should cause it to create new ones as if you did
it manually. Are you sure you didn't have some old object files cached
somewhere? Are you invoking the same version of Cython from setup.py
as you are from the command line?
Hmm... I'll take a look at that. Could you re-post your code so I can
try to reproduce it?
> ... do you want me to file a bug? [1]
Yes, please do.
/gerald