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

Speed up relative re-imports into absolute imports #2862

scoder opened this Issue Feb 23, 2019 · 0 comments


None yet
1 participant
Copy link

scoder commented Feb 23, 2019

Cython has to know the qualified module name at compile time, so the absolute package path of a relative import is actually known at compile time. We cannot change the way relative first imports work in general, because they are actually looked up relative to the current package, but we can still speed up re-imports (which are actually not that uncommon). Cython can construct the qualified name of a relative module import at compile time and look that up in sys.modules (as done in the ImportDottedModule helper function for absolute imports).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.