Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: cannot easily override a cython Include #2905

Closed
mattip opened this issue Mar 25, 2019 · 3 comments · Fixed by #2910
Closed

BUG: cannot easily override a cython Include #2905

mattip opened this issue Mar 25, 2019 · 3 comments · Fixed by #2910

Comments

@mattip
Copy link
Contributor

mattip commented Mar 25, 2019

I am trying to vendor numpy.pxd (or numpy/__init__.pxd) into numpy. It seems the file in Includes/numpy/__init__.pxd is seen before mine when I try cimport numpy.

To reproduce: copy the __init__.pxd from Includes/numpy into site-packages/numpy, and add garbage in the original file so using it will crash cython (I used xxxx = xxxxxxxxx). Then build a project that calls cimport numpy such as pandas. If the copy is found, cythonize will succeed. If the original version is found, cythonize will crash.

I am willing to work on a PR, but need some direction as to where to look for the problem.

@mattip
Copy link
Contributor Author

mattip commented Mar 25, 2019

I think the problem is that Includes is appended to the search path here, then later on sys.path is optionally appended to the search path here. IMO if sys_path is True the precedence should be

  • user provided include_directories
  • sys.path
  • Includes

instead of the current situation which gives precedence to Includes

@scoder
Copy link
Contributor

scoder commented Mar 30, 2019

I agree about the import path order. sys.path and Includes/ should be reversed.

@scoder
Copy link
Contributor

scoder commented Mar 30, 2019

PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants