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
Labels
3.7 (EOL)
end of life
3.8
only security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
Comments
>>> 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
|
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' |
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, ...). |
See #11930 I found this while I wrote tests about error messages. |
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)
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: