You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# In CPython>>> type(dict.__dict__["fromkeys"])
<class'classmethod_descriptor'>>>>type(dict.fromkeys)
<class'builtin_function_or_method'># In RustPython>>>>>type(dict.__dict__["fromkeys"])
<class'classmethod'>>>>>>type(dict.fromkeys)
<class'builtin_function_or_method'>
<class 'classmethod'> is for descriptors of Python-side @classmethod.
PyClassMethod_Type in CPython
PyClassMethod in RustPython
<class 'classmethod_descriptor'> is for descriptors of native-side class method.
PyClassMethodDescr_Type in CPython
Nothing in RustPython, instead using PyClassMethod
(Yeah, these names are somewhat confusing...)
In short, RustPython uses a different type from CPython for built-in class methods.
I don't know if it causes any real difference in behavior. There is no test for this in CPython (only a mysterious comment exists)
Activity
youknowone commentedon Mar 15, 2023
That's a sort of optimization detail. Once we try similar optimization, we will get it too. are you interested in it? I can explain more about it.
seungha-kim commentedon Mar 15, 2023
Sure. #4686 makes me look into it :)
Record independent closure recheck and correct draft wording
youknowone commentedon Oct 6, 2026
The originally reported problem no longer reproduces on current main. Closing per the recheck in #8982.
— commented by Grok 4.6