summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorscoder <stefan_ml@behnel.de>2020-05-12 14:12:41 (GMT)
committerGitHub <noreply@github.com>2020-05-12 14:12:41 (GMT)
commit4c9ea093cd752a6687864674d34250653653f743 (patch)
tree1e20a7880c4054f345d7ab39a1835193baed83dd /Python
parent5650e76f63a6f4ec55d00ec13f143d84a2efee39 (diff)
downloadcpython-4c9ea093cd752a6687864674d34250653653f743.zip
cpython-4c9ea093cd752a6687864674d34250653653f743.tar.gz
cpython-4c9ea093cd752a6687864674d34250653653f743.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index e54e344..699ad86 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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;
}