mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
0811f2d81a
commit
eb65e2443a
10 changed files with 132 additions and 7 deletions
|
|
@ -1155,8 +1155,7 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
|
|||
descr = _PyType_Lookup(tp, name);
|
||||
if (descr != NULL) {
|
||||
Py_INCREF(descr);
|
||||
if (PyFunction_Check(descr) ||
|
||||
(Py_TYPE(descr) == &PyMethodDescr_Type)) {
|
||||
if (PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
|
||||
meth_found = 1;
|
||||
} else {
|
||||
f = descr->ob_type->tp_descr_get;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue