Hello,

I've recently started using Cython in one of my projects because I
needed pyximport and automatic building of extensions and found that
adding .pyxdep files makes Cython raise NameError because _test_files
is not defined. Now oddly the comment says that _test_files is used
for tests, but since _test_files is not assigned anywhere it makes me
wonder how would tests even pass when it's supposed to generate
NameError in tests as well? Also it's quite strange that I looked as
far back as 0.11.3 and can't find _test_files assignment, but Google
shows that in 0.10.2 it seems it was there
(http://cython.sourcearchive.com/documentation/0.10.2/pyximport_8py-source.html).
It seems really strange to me how it was broken for that long! :-/

I just checked with Cython 0.14 and it seems that pyximport tests
indeed don't pass:

$ PYTHONPATH=. python pyximport/test/test_pyximport.py

1. pyximport.install is missing reload_support=True
2. NameError is raised during build because of _test_files
3. If _test_files = [] is added as was in 0.10.2 then AttributeError
is still raised because incorrect pyximport is imported.

Now if I fix both problems and run tests like this:

$ PYTHONPATH=pyximport:. python pyximport/test/test_pyximport.py

Then it finally seems to work. So pyximport and tests are obviously broken.

Also, there's another problem with pyximport that makes it unsafe to
use it without build_in_temp=False. For example, if I have
package1/module.pyx and package2/module.pyx then only one of those
will build/import correctly, because the same .c filename is used for
both. This is not a pyximport problem however, because pyxbuild merely
uses --pyrex-c-in-temp, and it causes build_ext.py to use hard-coded
"pyrex" temp subdirectory.

I hope someone can fix this.

Best regards,
Alexey Borzenkov.
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to