mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-113157 gh-89519: Fix method descriptors (gh-113233)
Restore behaviors before classmethod descriptor chaining was introduced.
This commit is contained in:
parent
6a5b4736e5
commit
d058eaeed4
2 changed files with 23 additions and 0 deletions
|
@ -319,6 +319,13 @@ method_traverse(PyMethodObject *im, visitproc visit, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
method_descr_get(PyObject *meth, PyObject *obj, PyObject *cls)
|
||||
{
|
||||
Py_INCREF(meth);
|
||||
return meth;
|
||||
}
|
||||
|
||||
PyTypeObject PyMethod_Type = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
.tp_name = "method",
|
||||
|
@ -339,6 +346,7 @@ PyTypeObject PyMethod_Type = {
|
|||
.tp_methods = method_methods,
|
||||
.tp_members = method_memberlist,
|
||||
.tp_getset = method_getset,
|
||||
.tp_descr_get = method_descr_get,
|
||||
.tp_new = method_new,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue