Filipe Laíns <[email protected]> added the comment:
Ah, this was not obvious to me! I did not specify a path, but as it defaults to
`sys.path` and `namespace.a` is available there, I was expecting it to find it.
One of the things that threw me off was the first arguments being called
`fullname`, which I assumed implied that `PathFinder` was able to do a
recursive search.
This indeed works:
```
$ ./python
Python 3.11.0a1+ (heads/main:9e05da6224, Oct 23 2021, 20:36:14) [GCC 11.1.0] on
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.machinery import PathFinder
>>> spec = PathFinder.find_spec('namespace')
>>> PathFinder.find_spec('a', path=spec.submodule_search_locations)
ModuleSpec(name='a', loader=<_frozen_importlib_external.SourceFileLoader object
at 0x7f245d0d3e80>, origin='/home/anubis/git/cpython/namespace/a.py')
```
I should have validated if normal packages also had the same behavior, which
they do, before opening this -.-
I am curious, what is `fullname` supposed to mean then? "full" in what sense?
----------
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com