NVIDIA / NVIDIA/cuda-python

Relative imports from Cython files in cuda_core cause duplicate imports

Offen
#2,023 5 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@acosmicflamingo arbeitet bereits daran.

Seit 23.7.2026.

bug cuda.core
Vorherrschende Sprache
Cython
Sterne
3.4k
Forks
329
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
113

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.