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

Misleading error when initing ImportError #69329

Closed
SebastianKreft mannequin opened this issue Sep 16, 2015 · 3 comments
Closed

Misleading error when initing ImportError #69329

SebastianKreft mannequin opened this issue Sep 16, 2015 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@SebastianKreft
Copy link
Mannequin

SebastianKreft mannequin commented Sep 16, 2015

BPO 25142
Nosy @brettcannon, @berkerpeksag
Superseder
  • bpo-21578: Misleading error message when ImportError called with invalid keyword args
  • 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 = <Date 2015-09-16.17:20:42.417>
    created_at = <Date 2015-09-16.14:48:47.921>
    labels = ['interpreter-core', 'type-feature']
    title = 'Misleading error when initing ImportError'
    updated_at = <Date 2015-09-16.17:20:42.415>
    user = 'https://bugs.python.org/SebastianKreft'

    bugs.python.org fields:

    activity = <Date 2015-09-16.17:20:42.415>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-09-16.17:20:42.417>
    closer = 'berker.peksag'
    components = ['Interpreter Core']
    creation = <Date 2015-09-16.14:48:47.921>
    creator = 'Sebastian Kreft'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 25142
    keywords = []
    message_count = 3.0
    messages = ['250850', '250854', '250856']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'berker.peksag', 'Sebastian Kreft']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '21578'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue25142'
    versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

    @SebastianKreft
    Copy link
    Mannequin Author

    SebastianKreft mannequin commented Sep 16, 2015

    ImportError now supports the keyword arguments name and path. However, when passing invalid keyword arguments, the reported error is misleading, as shown below.

    In [1]: ImportError('lib', name='lib')
    Out[1]: ImportError('lib')

    In [2]: ImportError('lib', name='lib', foo='foo')
    ---------------------------------------------------------------------------

    TypeError                                 Traceback (most recent call last)
    <ipython-input-2-5af12651187f> in <module>()
    ----> 1 ImportError('lib', name='lib', foo='foo')

    TypeError: ImportError does not take keyword arguments

    @brettcannon
    Copy link
    Member

    @brettcannon brettcannon added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Sep 16, 2015
    @berkerpeksag
    Copy link
    Member

    Thanks for the report. This is a duplicate of bpo-21578.

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants