mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)
… now that we allow subtypes of PyCFunction. Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.
This commit is contained in:
parent
5650e76f63
commit
4c9ea093cd
5 changed files with 10 additions and 4 deletions
|
@ -5054,7 +5054,7 @@ trace_call_function(PyThreadState *tstate,
|
|||
PyObject *kwnames)
|
||||
{
|
||||
PyObject *x;
|
||||
if (PyCFunction_Check(func)) {
|
||||
if (PyCFunction_CheckExact(func) || PyCMethod_CheckExact(func)) {
|
||||
C_TRACE(x, PyObject_Vectorcall(func, args, nargs, kwnames));
|
||||
return x;
|
||||
}
|
||||
|
@ -5115,7 +5115,7 @@ do_call_core(PyThreadState *tstate, PyObject *func, PyObject *callargs, PyObject
|
|||
{
|
||||
PyObject *result;
|
||||
|
||||
if (PyCFunction_Check(func)) {
|
||||
if (PyCFunction_CheckExact(func) || PyCMethod_CheckExact(func)) {
|
||||
C_TRACE(result, PyObject_Call(func, callargs, kwdict));
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue