New submission from Filipe Laíns <[email protected]>:
```
$ tree namespace
namespace/
└── a.py
0 directories, 1 file
```
```
$ ./python
Python 3.9.7 (default, Oct 10 2021, 15:13:22)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.machinery import PathFinder
>>> PathFinder.find_
PathFinder.find_distributions( PathFinder.find_module(
PathFinder.find_spec(
>>> PathFinder.find_spec('namespace')
ModuleSpec(name='namespace', loader=None,
submodule_search_locations=_NamespacePath(['/home/anubis/git/cpython/namespace']))
>>> PathFinder.find_spec('namespace.a')
```
Currently, it is unable to find namespace.a, but it should:
```
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')
>>> spec.loader.load_module('namespace.a')
<frozen importlib._bootstrap>:283: DeprecationWarning: the load_module() method
is deprecated and slated for removal in Python 3.12; use exec_module() instead
<module 'namespace.a' (<_frozen_importlib_external.NamespaceLoader object at
0x7f81b944f480>)>
```
I can make a PR, but just wanted to make sure the current behavior is not
intended.
----------
messages: 404912
nosy: FFY00, brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: PathFinder does not find namespace packages children
_______________________________________
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