Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error message during import #71031

Closed
axil mannequin opened this issue Apr 25, 2016 · 7 comments
Closed

Wrong error message during import #71031

axil mannequin opened this issue Apr 25, 2016 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@axil
Copy link
Mannequin

axil mannequin commented Apr 25, 2016

BPO 26844
Nosy @brettcannon, @ncoghlan, @ericsnowcurrently, @serhiy-storchaka, @axil
Files
  • error.diff
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2016-07-15.17:59:36.537>
    created_at = <Date 2016-04-25.06:09:06.045>
    labels = ['type-feature', 'library']
    title = 'Wrong error message during import'
    updated_at = <Date 2016-07-15.17:59:36.536>
    user = 'https://github.com/axil'

    bugs.python.org fields:

    activity = <Date 2016-07-15.17:59:36.536>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2016-07-15.17:59:36.537>
    closer = 'brett.cannon'
    components = ['Library (Lib)']
    creation = <Date 2016-04-25.06:09:06.045>
    creator = 'lev.maximov'
    dependencies = []
    files = ['42584']
    hgrepos = []
    issue_num = 26844
    keywords = ['patch']
    message_count = 7.0
    messages = ['264157', '264158', '269452', '269467', '269483', '270493', '270494']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'python-dev', 'eric.snow', 'serhiy.storchaka', 'lev.maximov']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26844'
    versions = ['Python 3.5', 'Python 3.6']

    @axil
    Copy link
    Mannequin Author

    axil mannequin commented Apr 25, 2016

    Error message was supposedly copy-pasted without change.
    Makes it pretty unintuinive to debug.
    Fix attached.

    @axil axil mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Apr 25, 2016
    @serhiy-storchaka
    Copy link
    Member

    LGTM.

    But while we are here, it would be nice to replace type(path) with type(path).__name__ (and the same for type(name)).

    @brettcannon brettcannon self-assigned this Apr 25, 2016
    @brettcannon
    Copy link
    Member

    Should we use __qualname__ instead of __name__?

    And I haven't forgotten about your patch, Lev. I'm just occupied trying to get feature changes into Python 3.6 as that has a sooner deadline than bug fixes.

    @axil
    Copy link
    Mannequin Author

    axil mannequin commented Jun 29, 2016

    Nevermind. It's not urgent but should definitely be fixed some day.
    Yes, __qualname__ might be a good idea.

    @serhiy-storchaka
    Copy link
    Member

    __qualname__ itself is not much more informative than __name__. You should use it together with __module__ to get the full qualified name. But 1) it is never used in error messages, 2) the code becomes more verbose, 3) the output becomes more verbose, and excessive verbose for builtin types.

    __name__ LGTM. It is enough to identify the error.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 15, 2016

    New changeset 22eaf6158e7b by Brett Cannon in branch '3.5':
    Issue bpo-26844: Fix imp.find_module() to have the exception related to
    https://hg.python.org/cpython/rev/22eaf6158e7b

    New changeset 46da639f7114 by Brett Cannon in branch 'default':
    Merge for bpo-26844
    https://hg.python.org/cpython/rev/46da639f7114

    @brettcannon
    Copy link
    Member

    Thanks for the patch, Lev!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants