Gregory Szorc <gregory.sz...@gmail.com> added the comment:

I worked around this in PyOxidizer by stripping a trailing `.__init__` from 
module names when resolving the indexed resource data. This allows the import 
to work since it can find the data now, but it also preserves the double module 
object, which isn't ideal IMO.

My preferred solution would be to either ban `__init__` in module name 
components or strip trailing `.__init__` from the name in `find_spec()`, 
effectively normalizing it away. Either of these would be backwards 
incompatible. Could either of these be considered for 3.10?

It's worth noting that `__init__` could potentially occur in the interior of 
the module name. e.g. `foo.__init__.bar`. This would require filenames like 
`foo/__init__/bar.py`. I wouldn't be surprised if this exists somewhere in the 
wild.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to