Skip to content

importlib.abc.Traversable.name does not match #89896

Closed

Description

@jmg
mannequin
BPO 45733

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-11-06.01:23:27.490>
labels = ['type-bug', '3.9', '3.10', '3.11']
title = 'importlib.abc.Traversable.name does not match'
updated_at = <Date 2021-11-06.01:23:27.490>
user = 'https://bugs.python.org/jmg'

bugs.python.org fields:

activity = <Date 2021-11-06.01:23:27.490>
actor = 'jmg'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-11-06.01:23:27.490>
creator = 'jmg'
dependencies = []
files = []
hgrepos = []
issue_num = 45733
keywords = []
message_count = 1.0
messages = ['405837']
nosy_count = 1.0
nosy_names = ['jmg']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue45733'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

Activity

  1. jmg commented on Nov 6, 2021

    jmgmannequin
    MannequinAuthor

    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)))
    
  2. added
    3.11only security fixes
    type-bugAn unexpected behavior, bug, or error
    on Nov 6, 2021
  3. transferred this issue fromon Apr 10, 2022
  4. warsaw commented on Jun 10, 2022

    @warsaw
    Member

    Yikes! I just ran into this too. I'll test it on newer versions and submit a PR. Should be an easy documentation fix.

  5. warsaw commented on Jun 10, 2022

    @warsaw
    Member

    Well, not so easy apparently because of the importlib docs got reorg'd in main, so it'll take a couple of PRs most likely.

  6. warsaw commented on Jun 10, 2022

    @warsaw
    Member

    Turns out, this is fixed in main but there's another problem (#93610) for which I created a PR first.

  7. added 3 commits that reference this issue on Jun 10, 2022
    a43d8dc
    1f47e59
  8. jaraco commented on Nov 26, 2022

    @jaraco
    Member

    Looks like this work was done. Thanks warsaw and jmg. Please comment or re-open if the issue remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions