bpo-19072: Make @classmethod support chained decorators (GH-8405)

This commit is contained in:
Berker Peksag 2019-08-25 01:37:25 +03:00 committed by Raymond Hettinger
parent 0dfc025ccc
commit 805f8f9afe
5 changed files with 71 additions and 2 deletions

View file

@ -741,6 +741,10 @@ cm_descr_get(PyObject *self, PyObject *obj, PyObject *type)
}
if (type == NULL)
type = (PyObject *)(Py_TYPE(obj));
if (Py_TYPE(cm->cm_callable)->tp_descr_get != NULL) {
return Py_TYPE(cm->cm_callable)->tp_descr_get(cm->cm_callable, type,
NULL);
}
return PyMethod_New(cm->cm_callable, type);
}