Non-package module loaded from ModInfo object retains __path__ from previously loaded package.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Merge medio
- 1g 9h
- PR unite (30g)
- 558
Descrizione
Bug report
Assume you have two separate modules with the same name. One is a package, one is not.
Use pkgutil.itermodules to get a ModuleInfo object for the package, then load the it using find_module and load_module. This object has a __path__ object with the location of package, as expected.
Next, do the same for the non-package module. The resulting module object should have no __path__ attribute, but instead it has one with the location of the package opened previously.
This can be replicated with a structure such as \module\submodule\submodule.py, using \module and \module\submodule as the arguments for the two calls to pkgutil.itermodules.
Your environment
- CPython versions tested on: 3.10.7, 3.11.0rc2
- Operating system and architecture: Windows 10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il comportamento con i due layout dei moduli descritti nell’issue, usando pkgutil.itermodules seguito da find_module e load_module. Confronta gli oggetti modulo di package e non-package; il lavoro è completato quando il modulo non-package non conserva più un path del package caricato in precedenza.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100