Issue 36433: Unhelpful error message in classmethoddescr_call() (original) (raw)

Issue36433

Created on 2019-03-26 08:11 by methane, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12556 merged methane,2019-03-26 08:31
PR 12557 merged miss-islington,2019-03-26 09:26
Messages (6)
msg338860 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-03-26 08:11
>>> desc = dict.__dict__['fromkeys'] >>> desc(int, []) Traceback (most recent call last): File "", line 1, in TypeError: descriptor 'fromkeys' requires a subtype of 'dict' but received 'type `'type` should be `'int'`.
msg338861 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-26 08:19
More confusing error message: >>> desc(1, []) Traceback (most recent call last): File "", line 1, in TypeError: descriptor 'fromkeys' requires a type but received a 'dict'
msg338866 - (view) Author: miss-islington (miss-islington) Date: 2019-03-26 09:26
New changeset 871309c775fd4d72048bfaa31affd54f9934f7dd by Miss Islington (bot) (Inada Naoki) in branch 'master': bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556) https://github.com/python/cpython/commit/871309c775fd4d72048bfaa31affd54f9934f7dd
msg338869 - (view) Author: miss-islington (miss-islington) Date: 2019-03-26 09:47
New changeset 03440850e7266aa7fd531c7f281a3fdcf17f90a4 by Miss Islington (bot) in branch '3.7': bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556) https://github.com/python/cpython/commit/03440850e7266aa7fd531c7f281a3fdcf17f90a4
msg338947 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-03-27 09:52
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, ...).
msg338948 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-03-27 09:55
See https://github.com/python/cpython/pull/11930 I found this while I wrote tests about error messages.
History
Date User Action Args
2022-04-11 14:59:13 admin set github: 80614
2019-03-27 09:55:02 methane set messages: +
2019-03-27 09:52:29 jdemeyer set nosy: + jdemeyermessages: +
2019-03-26 09:50:45 methane set status: open -> closedresolution: fixedstage: patch review -> resolved
2019-03-26 09:47:10 miss-islington set messages: +
2019-03-26 09:26:48 miss-islington set pull_requests: + <pull%5Frequest12503>
2019-03-26 09:26:35 miss-islington set nosy: + miss-islingtonmessages: +
2019-03-26 08:31:46 methane set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest12502>
2019-03-26 08:19:54 serhiy.storchaka set messages: +
2019-03-26 08🔞38 serhiy.storchaka set nosy: + serhiy.storchaka
2019-03-26 08:11:55 methane create