This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Simplify implementation of classmethod_descriptor.__call__
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, jdemeyer, petr.viktorin, rhettinger
Priority: normal Keywords: patch

Created on 2019-05-15 11:58 by jdemeyer, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13340 open jdemeyer, 2019-05-15 12:17
Messages (3)
msg342566 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-05-15 11:58
The class classmethod_descriptor implements classmethods for builtin functions. Unlike the plain classmethod class (which is used for Python classmethods), instances of classmethod_descriptor are callable. However, calling them is unlikely to happen in practice: the only way to obtain such an object is to extract from the class __dict__.

Therefore, the implementation of __call__ does not need to be optimized: we can just call __get__ and then call the result. Doing that allows a simpler implementation of PEP 590.
msg344578 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-06-04 14:41
I opened a more general issue #37151
msg345015 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-06-07 23:23
> However, calling them is unlikely to happen in practice: the 
> only way to obtain such an object is to extract from the 
> class __dict__.

Generally the experience of the PyPy team has been that every code that a user can take is in fact taken by some users.  Usually, we don't get to change a publicly accessible API to facilitate an optimization.
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81105
2019-07-01 15:28:14jdemeyersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-07 23:23:55rhettingersetnosy: + rhettinger
messages: + msg345015
2019-06-04 14:41:03jdemeyersetmessages: + msg344578
2019-05-15 12:17:16jdemeyersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13252
2019-05-15 11:58:26jdemeyercreate