diff options
| author | scoder <stefan_ml@behnel.de> | 2020-05-12 16:12:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-12 07:12:41 -0700 |
| commit | 4c9ea093cd752a6687864674d34250653653f743 (patch) | |
| tree | 1e20a7880c4054f345d7ab39a1835193baed83dd /Include/cpython/methodobject.h | |
| parent | 5650e76f63a6f4ec55d00ec13f143d84a2efee39 (diff) | |
| download | cpython-git-4c9ea093cd752a6687864674d34250653653f743.tar.gz | |
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/cpython/methodobject.h')
| -rw-r--r-- | Include/cpython/methodobject.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/cpython/methodobject.h b/Include/cpython/methodobject.h index 2ac2cbf36a..7ecbfe3b5e 100644 --- a/Include/cpython/methodobject.h +++ b/Include/cpython/methodobject.h @@ -4,6 +4,9 @@ PyAPI_DATA(PyTypeObject) PyCMethod_Type; +#define PyCMethod_CheckExact(op) Py_IS_TYPE(op, &PyCMethod_Type) +#define PyCMethod_Check(op) PyObject_TypeCheck(op, &PyCMethod_Type) + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyCFunction_GET_FUNCTION(func) \ |
