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

Unhelpful error message in classmethoddescr_call() #80614

Closed
methane opened this issue Mar 26, 2019 · 6 comments
Closed

Unhelpful error message in classmethoddescr_call() #80614

methane opened this issue Mar 26, 2019 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@methane
Copy link
Member

methane commented Mar 26, 2019

BPO 36433
Nosy @methane, @serhiy-storchaka, @jdemeyer, @miss-islington
PRs
  • bpo-36433: fix confusing error messages in classmethoddescr_call #12556
  • [3.7] bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556) #12557
  • 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 2019-03-26.09:50:45.347>
    created_at = <Date 2019-03-26.08:11:55.738>
    labels = ['interpreter-core', '3.7', '3.8']
    title = 'Unhelpful error message in classmethoddescr_call()'
    updated_at = <Date 2019-03-27.09:55:02.365>
    user = 'https://github.com/methane'

    bugs.python.org fields:

    activity = <Date 2019-03-27.09:55:02.365>
    actor = 'methane'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-03-26.09:50:45.347>
    closer = 'methane'
    components = ['Interpreter Core']
    creation = <Date 2019-03-26.08:11:55.738>
    creator = 'methane'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36433
    keywords = ['patch']
    message_count = 6.0
    messages = ['338860', '338861', '338866', '338869', '338947', '338948']
    nosy_count = 4.0
    nosy_names = ['methane', 'serhiy.storchaka', 'jdemeyer', 'miss-islington']
    pr_nums = ['12556', '12557']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36433'
    versions = ['Python 3.7', 'Python 3.8']

    @methane
    Copy link
    Member Author

    methane commented Mar 26, 2019

    >>> desc = dict.__dict__['fromkeys']
    >>> desc(int, [])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: descriptor 'fromkeys' requires a subtype of 'dict' but received 'type

    'type should be 'int'.

    @methane methane added 3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Mar 26, 2019
    @serhiy-storchaka
    Copy link
    Member

    More confusing error message:

    >>> desc(1, [])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: descriptor 'fromkeys' requires a type but received a 'dict'

    @miss-islington
    Copy link
    Contributor

    New changeset 871309c by Miss Islington (bot) (Inada Naoki) in branch 'master':
    bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
    871309c

    @miss-islington
    Copy link
    Contributor

    New changeset 0344085 by Miss Islington (bot) in branch '3.7':
    bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
    0344085

    @methane methane closed this as completed Mar 26, 2019
    @jdemeyer
    Copy link
    Contributor

    I am curious, how did you find out about this bug? Do you have a concrete use case for directly calling an instance of classmethod_descriptor? Typically, one would write dict.fromkeys(...) instead of dict.__dict__['fromkeys'](dict, ...).

    @methane
    Copy link
    Member Author

    methane commented Mar 27, 2019

    See #11930

    I found this while I wrote tests about error messages.

    @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
    3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants