mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-132747: Fix NULL
dereference when calling a method's __get__
manually (#132772)
This commit is contained in:
parent
c8e0b6e684
commit
fa70bf8593
3 changed files with 22 additions and 1 deletions
|
@ -145,7 +145,7 @@ method_get(PyObject *self, PyObject *obj, PyObject *type)
|
|||
return NULL;
|
||||
}
|
||||
if (descr->d_method->ml_flags & METH_METHOD) {
|
||||
if (PyType_Check(type)) {
|
||||
if (type == NULL || PyType_Check(type)) {
|
||||
return PyCMethod_New(descr->d_method, obj, NULL, descr->d_common.d_type);
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue