diff options
author | scoder <stefan_ml@behnel.de> | 2020-05-12 14:12:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 14:12:41 (GMT) |
commit | 4c9ea093cd752a6687864674d34250653653f743 (patch) | |
tree | 1e20a7880c4054f345d7ab39a1835193baed83dd /Include/methodobject.h | |
parent | 5650e76f63a6f4ec55d00ec13f143d84a2efee39 (diff) | |
download | cpython-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 'Include/methodobject.h')
-rw-r--r-- | Include/methodobject.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/methodobject.h b/Include/methodobject.h index 7c7362c..12e049b 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -13,7 +13,8 @@ extern "C" { PyAPI_DATA(PyTypeObject) PyCFunction_Type; -#define PyCFunction_Check(op) (Py_IS_TYPE(op, &PyCFunction_Type) || (PyType_IsSubtype(Py_TYPE(op), &PyCFunction_Type))) +#define PyCFunction_CheckExact(op) Py_IS_TYPE(op, &PyCFunction_Type) +#define PyCFunction_Check(op) PyObject_TypeCheck(op, &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t); |