NVIDIA / NVIDIA/cuda-python

Relative imports from Cython files in cuda_core cause duplicate imports

Aperta
#2,023 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@acosmicflamingo ci sta già lavorando.

Dal 23/7/2026.

bug cuda.core
Lingua principale
Cython
Stelle
3.4k
Fork
329
Merge medio
1g 23h
PR unite (30g)
116

Descrizione

If you have code like

from . import typing

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.