If you have code like
in a .pyx file, and another part of the system does:
from cuda.core.system import typing
it causes the typing module to be imported twice.
The first import places the module in sys.modules as cuda.core.cu13.system.typing, and the second import places the module in cuda.core.system.typing. It means that any isinstance checks on classes in this module will fail.
This is clearly a side effect of the "megapackage" approach handled by _import_versioned_module. It is not clear whether we can address it at that level.
At a minimum, maybe we can write a lint or an AGENT.md rule that relative imports should be avoided from Cython modules.
If you have code like
in a .pyx file, and another part of the system does:
it causes the typing module to be imported twice.
The first import places the module in
sys.modulesascuda.core.cu13.system.typing, and the second import places the module incuda.core.system.typing. It means that anyisinstancechecks on classes in this module will fail.This is clearly a side effect of the "megapackage" approach handled by
_import_versioned_module. It is not clear whether we can address it at that level.At a minimum, maybe we can write a lint or an AGENT.md rule that relative imports should be avoided from Cython modules.