diff options
Diffstat (limited to 'Include')
32 files changed, 79 insertions, 74 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 764d7d8..b7fde09 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -1051,7 +1051,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ #define PySequence_ITEM(o, i)\ - ( Py_Type(o)->tp_as_sequence->sq_item(o, i) ) + ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) /* Assume tp_as_sequence and sq_item exist and that i does not need to be corrected for a negative index */ diff --git a/Include/boolobject.h b/Include/boolobject.h index 6499345..74e854f 100644 --- a/Include/boolobject.h +++ b/Include/boolobject.h @@ -11,7 +11,7 @@ typedef PyIntObject PyBoolObject; PyAPI_DATA(PyTypeObject) PyBool_Type; -#define PyBool_Check(x) (Py_Type(x) == &PyBool_Type) +#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) /* Py_False and Py_True are the only two bools in existence. Don't forget to apply Py_INCREF() when returning either!!! */ diff --git a/Include/bufferobject.h b/Include/bufferobject.h index 639b08d..6dd8345 100644 --- a/Include/bufferobject.h +++ b/Include/bufferobject.h @@ -12,7 +12,7 @@ extern "C" { PyAPI_DATA(PyTypeObject) PyBuffer_Type; -#define PyBuffer_Check(op) (Py_Type(op) == &PyBuffer_Type) +#define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type) #define Py_END_OF_BUFFER (-1) diff --git a/Include/cStringIO.h b/Include/cStringIO.h index 50f8cbe..d22b9eb 100644 --- a/Include/cStringIO.h +++ b/Include/cStringIO.h @@ -60,9 +60,9 @@ static struct PycStringIO_CAPI { /* These can be used to test if you have one */ #define PycStringIO_InputCheck(O) \ - (Py_Type(O)==PycStringIO->InputType) + (Py_TYPE(O)==PycStringIO->InputType) #define PycStringIO_OutputCheck(O) \ - (Py_Type(O)==PycStringIO->OutputType) + (Py_TYPE(O)==PycStringIO->OutputType) #ifdef __cplusplus } diff --git a/Include/cellobject.h b/Include/cellobject.h index 1036420..c927ee5 100644 --- a/Include/cellobject.h +++ b/Include/cellobject.h @@ -13,7 +13,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyCell_Type; -#define PyCell_Check(op) (Py_Type(op) == &PyCell_Type) +#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); diff --git a/Include/cobject.h b/Include/cobject.h index 0e0ed1b..499dfad 100644 --- a/Include/cobject.h +++ b/Include/cobject.h @@ -16,7 +16,7 @@ extern "C" { PyAPI_DATA(PyTypeObject) PyCObject_Type; -#define PyCObject_Check(op) (Py_Type(op) == &PyCObject_Type) +#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type) /* Create a PyCObject from a pointer to a C object and an optional destructor function. If the second argument is non-null, then it diff --git a/Include/code.h b/Include/code.h index 2ec756b..07e3b1f 100644 --- a/Include/code.h +++ b/Include/code.h @@ -60,7 +60,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyCode_Type; -#define PyCode_Check(op) (Py_Type(op) == &PyCode_Type) +#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) /* Public interface */ @@ -72,7 +72,7 @@ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ - ((*Py_Type((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \ + ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \ ((co)->co_code, 0, (void **)(pp))) typedef struct _addr_pair { diff --git a/Include/complexobject.h b/Include/complexobject.h index 3e1cda5..b036444 100644 --- a/Include/complexobject.h +++ b/Include/complexobject.h @@ -43,7 +43,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) -#define PyComplex_CheckExact(op) (Py_Type(op) == &PyComplex_Type) +#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); diff --git a/Include/datetime.h b/Include/datetime.h index 43e3093..0d310b4 100644 --- a/Include/datetime.h +++ b/Include/datetime.h @@ -166,19 +166,19 @@ typedef struct { /* Macros for type checking when building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) -#define PyDate_CheckExact(op) (Py_Type(op) == &PyDateTime_DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) -#define PyDateTime_CheckExact(op) (Py_Type(op) == &PyDateTime_DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) -#define PyTime_CheckExact(op) (Py_Type(op) == &PyDateTime_TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) -#define PyDelta_CheckExact(op) (Py_Type(op) == &PyDateTime_DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) -#define PyTZInfo_CheckExact(op) (Py_Type(op) == &PyDateTime_TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) #else @@ -198,19 +198,19 @@ static PyDateTime_CAPI *PyDateTimeAPI; /* Macros for type checking when not building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) -#define PyDate_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) -#define PyDateTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) -#define PyTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) -#define PyDelta_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) -#define PyTZInfo_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) /* Macros for accessing constructors in a simplified fashion. */ #define PyDate_FromDate(year, month, day) \ diff --git a/Include/descrobject.h b/Include/descrobject.h index a45a801..0d444b6 100644 --- a/Include/descrobject.h +++ b/Include/descrobject.h @@ -77,7 +77,7 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); -#define PyDescr_IsData(d) (Py_Type(d)->tp_descr_set != NULL) +#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); diff --git a/Include/dictobject.h b/Include/dictobject.h index c5378cf..b83cd0e 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -91,8 +91,8 @@ struct _dictobject { PyAPI_DATA(PyTypeObject) PyDict_Type; #define PyDict_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS) -#define PyDict_CheckExact(op) (Py_Type(op) == &PyDict_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) +#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); diff --git a/Include/fileobject.h b/Include/fileobject.h index dde5b8f..75b0f03 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -30,7 +30,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyFile_Type; #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) -#define PyFile_CheckExact(op) (Py_Type(op) == &PyFile_Type) +#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type) PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); diff --git a/Include/floatobject.h b/Include/floatobject.h index 85537f1..1f4510b 100644 --- a/Include/floatobject.h +++ b/Include/floatobject.h @@ -19,7 +19,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) -#define PyFloat_CheckExact(op) (Py_Type(op) == &PyFloat_Type) +#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) PyAPI_FUNC(double) PyFloat_GetMax(void); PyAPI_FUNC(double) PyFloat_GetMin(void); diff --git a/Include/funcobject.h b/Include/funcobject.h index 3e37e11..eb19f4c 100644 --- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -39,7 +39,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyFunction_Type; -#define PyFunction_Check(op) (Py_Type(op) == &PyFunction_Type) +#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); diff --git a/Include/genobject.h b/Include/genobject.h index f9d9b16..11c6823 100644 --- a/Include/genobject.h +++ b/Include/genobject.h @@ -26,7 +26,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyGen_Type; #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) -#define PyGen_CheckExact(op) (Py_Type(op) == &PyGen_Type) +#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); diff --git a/Include/iterobject.h b/Include/iterobject.h index 8e17d35..4bd19c2 100644 --- a/Include/iterobject.h +++ b/Include/iterobject.h @@ -7,13 +7,13 @@ extern "C" { PyAPI_DATA(PyTypeObject) PySeqIter_Type; -#define PySeqIter_Check(op) (Py_Type(op) == &PySeqIter_Type) +#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); PyAPI_DATA(PyTypeObject) PyCallIter_Type; -#define PyCallIter_Check(op) (Py_Type(op) == &PyCallIter_Type) +#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus diff --git a/Include/listobject.h b/Include/listobject.h index e8b192a..c445873 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -41,8 +41,8 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyList_Type; #define PyList_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LIST_SUBCLASS) -#define PyList_CheckExact(op) (Py_Type(op) == &PyList_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) +#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); @@ -60,7 +60,7 @@ PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); /* Macro, trading safety for speed */ #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) -#define PyList_GET_SIZE(op) Py_Size(op) +#define PyList_GET_SIZE(op) Py_SIZE(op) #ifdef __cplusplus } diff --git a/Include/longobject.h b/Include/longobject.h index 657cd0b..13f2e41 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -12,8 +12,8 @@ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ PyAPI_DATA(PyTypeObject) PyLong_Type; #define PyLong_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LONG_SUBCLASS) -#define PyLong_CheckExact(op) (Py_Type(op) == &PyLong_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) +#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) PyAPI_FUNC(PyObject *) PyLong_FromLong(long); PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); diff --git a/Include/methodobject.h b/Include/methodobject.h index 511a747..810a69c 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -13,7 +13,7 @@ extern "C" { PyAPI_DATA(PyTypeObject) PyCFunction_Type; -#define PyCFunction_Check(op) (Py_Type(op) == &PyCFunction_Type) +#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, diff --git a/Include/moduleobject.h b/Include/moduleobject.h index c43cb93..b387f5b 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -10,7 +10,7 @@ extern "C" { PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) -#define PyModule_CheckExact(op) (Py_Type(op) == &PyModule_Type) +#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) PyAPI_FUNC(PyObject *) PyModule_New(const char *); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); diff --git a/Include/object.h b/Include/object.h index daba4b6..b434a21 100644 --- a/Include/object.h +++ b/Include/object.h @@ -111,9 +111,14 @@ typedef struct { PyObject_VAR_HEAD } PyVarObject; -#define Py_Refcnt(ob) (((PyObject*)(ob))->ob_refcnt) -#define Py_Type(ob) (((PyObject*)(ob))->ob_type) -#define Py_Size(ob) (((PyVarObject*)(ob))->ob_size) +#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) +#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + +/* B/w compatibility */ +#define Py_Refcnt(ob) Py_REFCNT(op) +#define Py_Type(op) Py_TYPE(op) +#define Py_Size(op) Py_SIZE(op) /* Type objects contain a string containing the type name (to help somewhat @@ -370,21 +375,21 @@ typedef struct _heaptypeobject { /* access macro to the members which are floating "behind" the object */ #define PyHeapType_GET_MEMBERS(etype) \ - ((PyMemberDef *)(((char *)etype) + Py_Type(etype)->tp_basicsize)) + ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); #define PyObject_TypeCheck(ob, tp) \ - (Py_Type(ob) == (tp) || PyType_IsSubtype(Py_Type(ob), (tp))) + (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ #define PyType_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TYPE_SUBCLASS) -#define PyType_CheckExact(op) (Py_Type(op) == &PyType_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) +#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); @@ -619,9 +624,9 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); #ifdef COUNT_ALLOCS PyAPI_FUNC(void) inc_count(PyTypeObject *); PyAPI_FUNC(void) dec_count(PyTypeObject *); -#define _Py_INC_TPALLOCS(OP) inc_count(Py_Type(OP)) -#define _Py_INC_TPFREES(OP) dec_count(Py_Type(OP)) -#define _Py_DEC_TPFREES(OP) Py_Type(OP)->tp_frees-- +#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) +#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) +#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- #define _Py_COUNT_ALLOCS_COMMA , #else #define _Py_INC_TPALLOCS(OP) @@ -646,13 +651,13 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #define _Py_NewReference(op) ( \ _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ - Py_Refcnt(op) = 1) + Py_REFCNT(op) = 1) #define _Py_ForgetReference(op) _Py_INC_TPFREES(op) #define _Py_Dealloc(op) ( \ _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ - (*Py_Type(op)->tp_dealloc)((PyObject *)(op))) + (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ #define Py_INCREF(op) ( \ diff --git a/Include/objimpl.h b/Include/objimpl.h index 9f8523f..ef47218 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -154,9 +154,9 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); /* Macros trading binary compatibility for speed. See also pymem.h. Note that these macros expect non-NULL object pointers.*/ #define PyObject_INIT(op, typeobj) \ - ( Py_Type(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) + ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) #define PyObject_INIT_VAR(op, typeobj, size) \ - ( Py_Size(op) = (size), PyObject_INIT((op), (typeobj)) ) + ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) @@ -231,8 +231,8 @@ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) /* Test if an object has a GC head */ -#define PyObject_IS_GC(o) (PyType_IS_GC(Py_Type(o)) && \ - (Py_Type(o)->tp_is_gc == NULL || Py_Type(o)->tp_is_gc(o))) +#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ + (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); #define PyObject_GC_Resize(type, op, n) \ @@ -328,7 +328,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *); && ((t)->tp_weaklistoffset > 0)) #define PyObject_GET_WEAKREFS_LISTPTR(o) \ - ((PyObject **) (((char *) (o)) + Py_Type(o)->tp_weaklistoffset)) + ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) #ifdef __cplusplus } diff --git a/Include/py_curses.h b/Include/py_curses.h index 62d00d8..b045a59 100644 --- a/Include/py_curses.h +++ b/Include/py_curses.h @@ -73,7 +73,7 @@ typedef struct { WINDOW *win; } PyCursesWindowObject; -#define PyCursesWindow_Check(v) (Py_Type(v) == &PyCursesWindow_Type) +#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) #ifdef CURSES_MODULE /* This section is used when compiling _cursesmodule.c */ diff --git a/Include/rangeobject.h b/Include/rangeobject.h index 407fd16..36c9cee 100644 --- a/Include/rangeobject.h +++ b/Include/rangeobject.h @@ -20,7 +20,7 @@ they are represented by a start, stop, and step datamembers. PyAPI_DATA(PyTypeObject) PyRange_Type; -#define PyRange_Check(op) (Py_Type(op) == &PyRange_Type) +#define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) #ifdef __cplusplus } diff --git a/Include/setobject.h b/Include/setobject.h index 8914749..2739d62 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -66,13 +66,13 @@ PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; * hash is -1 */ -#define PyFrozenSet_CheckExact(ob) (Py_Type(ob) == &PyFrozenSet_Type) +#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_CheckExact(ob) \ - (Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type) + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_Check(ob) \ - (Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type || \ - PyType_IsSubtype(Py_Type(ob), &PySet_Type) || \ - PyType_IsSubtype(Py_Type(ob), &PyFrozenSet_Type)) + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ + PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) PyAPI_FUNC(PyObject *) PySet_New(PyObject *); PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); diff --git a/Include/sliceobject.h b/Include/sliceobject.h index 21bc025..dfc30c7 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -26,7 +26,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PySlice_Type; -#define PySlice_Check(op) (Py_Type(op) == &PySlice_Type) +#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); diff --git a/Include/stringobject.h b/Include/stringobject.h index cc79462..e3f880a 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -56,8 +56,8 @@ PyAPI_DATA(PyTypeObject) PyBaseString_Type; PyAPI_DATA(PyTypeObject) PyString_Type; #define PyString_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyString_CheckExact(op) (Py_Type(op) == &PyString_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyString_FromString(const char *); @@ -89,7 +89,7 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) -#define PyString_GET_SIZE(op) Py_Size(op) +#define PyString_GET_SIZE(op) Py_SIZE(op) /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ diff --git a/Include/symtable.h b/Include/symtable.h index 28fd978..025e07b 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -49,7 +49,7 @@ typedef struct _symtable_entry { PyAPI_DATA(PyTypeObject) PySTEntry_Type; -#define PySTEntry_Check(op) (Py_Type(op) == &PySTEntry_Type) +#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); diff --git a/Include/traceback.h b/Include/traceback.h index 4c7b8cc..0b3bfae 100644 --- a/Include/traceback.h +++ b/Include/traceback.h @@ -22,7 +22,7 @@ PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; -#define PyTraceBack_Check(v) (Py_Type(v) == &PyTraceBack_Type) +#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) #ifdef __cplusplus } diff --git a/Include/tupleobject.h b/Include/tupleobject.h index 423103a..1b51b1b 100644 --- a/Include/tupleobject.h +++ b/Include/tupleobject.h @@ -34,8 +34,8 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyTuple_Type; #define PyTuple_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TUPLE_SUBCLASS) -#define PyTuple_CheckExact(op) (Py_Type(op) == &PyTuple_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) +#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); @@ -47,7 +47,7 @@ PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); /* Macro, trading safety for speed */ #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) -#define PyTuple_GET_SIZE(op) Py_Size(op) +#define PyTuple_GET_SIZE(op) Py_SIZE(op) /* Macro, *only* to be used to fill in brand new tuples */ #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index a774d52..6c33045 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -401,8 +401,8 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyUnicode_Type; #define PyUnicode_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_UNICODE_SUBCLASS) -#define PyUnicode_CheckExact(op) (Py_Type(op) == &PyUnicode_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) +#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) /* Fast access macros */ #define PyUnicode_GET_SIZE(op) \ diff --git a/Include/weakrefobject.h b/Include/weakrefobject.h index e58c352..f15c9d9c 100644 --- a/Include/weakrefobject.h +++ b/Include/weakrefobject.h @@ -44,10 +44,10 @@ PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) #define PyWeakref_CheckRefExact(op) \ - (Py_Type(op) == &_PyWeakref_RefType) + (Py_TYPE(op) == &_PyWeakref_RefType) #define PyWeakref_CheckProxy(op) \ - ((Py_Type(op) == &_PyWeakref_ProxyType) || \ - (Py_Type(op) == &_PyWeakref_CallableProxyType)) + ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ + (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) /* This macro calls PyWeakref_CheckRef() last since that can involve a function call; this makes it more likely that the function call |