Skip to content

Commit 9267d9a

Browse files
committed
Py_IS_TYPE() no longer uses const PyObject* type
Just use "PyObject*" type.
1 parent 85d1bd8 commit 9267d9a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pythoncapi_compat.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ extern "C" {
4545
#ifndef _PyObject_CAST
4646
# define _PyObject_CAST(op) PYCAPI_COMPAT_CAST(PyObject*, op)
4747
#endif
48-
#ifndef _PyObject_CAST_CONST
49-
# define _PyObject_CAST_CONST(op) PYCAPI_COMPAT_CAST(const PyObject*, op)
50-
#endif
5148

5249

5350
// bpo-42262 added Py_NewRef() to Python 3.10.0a3
@@ -441,10 +438,10 @@ PyObject_GC_IsFinalized(PyObject *obj)
441438
// bpo-39573 added Py_IS_TYPE() to Python 3.9.0a4
442439
#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_IS_TYPE)
443440
PYCAPI_COMPAT_STATIC_INLINE(int)
444-
_Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
445-
return ob->ob_type == type;
441+
_Py_IS_TYPE(PyObject *ob, PyTypeObject *type) {
442+
return Py_TYPE(ob) == type;
446443
}
447-
#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
444+
#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST(ob), type)
448445
#endif
449446

450447

0 commit comments

Comments
 (0)