Skip to content

Speed up relative re-imports into absolute imports #2862

Description

@scoder

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).

Requires C / C-API knowledge.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions