This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importlib.abc.Traversable.name does not match
Type: behavior Stage:
Components: Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jmg
Priority: normal Keywords:

Created on 2021-11-06 01:23 by jmg, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg405837 - (view) Author: John-Mark Gurney (jmg) Date: 2021-11-06 01:23
The documentation for Traversable.name says it is a method, not a property:
https://docs.python.org/3/library/importlib.html#importlib.abc.Traversable.name

The issue is that with Python 3.9.7 (default, Nov  1 2021, 11:26:33), using a standard posix module (on MacOSX), it returns a string and not a method.  I have not tested on newer versions, but expect similar issues.  I have tagged the newer versions to get exposure, feel free to untag the versions that are confirmed to be unaffected by this bug.

```
$ python3.9
Python 3.9.7 (default, Nov  1 2021, 11:26:33) 
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod
<class 'str'>
>>> ^D
```

This is with a module dir named `mod`, w/ an empty `res.txt` file, and the following in `__init__.py`:
```
from importlib import resources

r = resources.files(__name__) / 'res.txt'

print(repr(type(r.name)))
```
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89896
2021-11-06 01:23:27jmgcreate