New submission from John-Mark Gurney <j...@funkthat.com>:

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)))
```

----------
messages: 405837
nosy: jmg
priority: normal
severity: normal
status: open
title: importlib.abc.Traversable.name does not match
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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

Reply via email to