diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-19 02:45:37 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-19 02:45:37 (GMT) |
commit | 90aa7646affbaee9628ca6ea6a702aec17b3b550 (patch) | |
tree | e820962e9658a92c7147b686f8aa88c7658c5949 /Include | |
parent | 99170a5dbf4cfee78b578672b6821e855f92594b (diff) | |
download | cpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.zip cpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.tar.gz cpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.tar.bz2 |
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Diffstat (limited to 'Include')
33 files changed, 79 insertions, 79 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index e344fba..468afe9 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -1070,7 +1070,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 33f8112..7cc2f1f 100644 --- a/Include/boolobject.h +++ b/Include/boolobject.h @@ -9,7 +9,7 @@ extern "C" { 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/bytesobject.h b/Include/bytesobject.h index e9c319c..49d1d38 100644 --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -33,7 +33,7 @@ PyAPI_DATA(PyTypeObject) PyBytesIter_Type; /* Type check macros */ #define PyBytes_Check(self) PyObject_TypeCheck(self, &PyBytes_Type) -#define PyBytes_CheckExact(self) (Py_Type(self) == &PyBytes_Type) +#define PyBytes_CheckExact(self) (Py_TYPE(self) == &PyBytes_Type) /* Direct API functions */ PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); @@ -45,7 +45,7 @@ PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t); /* Macros, trading safety for speed */ #define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes) -#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_Size(self)) +#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_SIZE(self)) #ifdef __cplusplus } 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 3f3df49..56d6cb5 100644 --- a/Include/code.h +++ b/Include/code.h @@ -59,7 +59,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 badfa5b..f06b421 100644 --- a/Include/descrobject.h +++ b/Include/descrobject.h @@ -82,7 +82,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 afc55af..76fc75b 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -97,11 +97,11 @@ PyAPI_DATA(PyTypeObject) PyDictItems_Type; PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ - PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS) -#define PyDict_CheckExact(op) (Py_Type(op) == &PyDict_Type) -#define PyDictKeys_Check(op) (Py_Type(op) == &PyDictKeys_Type) -#define PyDictItems_Check(op) (Py_Type(op) == &PyDictItems_Type) -#define PyDictValues_Check(op) (Py_Type(op) == &PyDictValues_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) +#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) +#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) +#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) /* This excludes Values, since they are not sets. */ # define PyDictViewSet_Check(op) \ (PyDictKeys_Check(op) || PyDictItems_Check(op)) diff --git a/Include/floatobject.h b/Include/floatobject.h index b9c79c7..f18933b 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/frameobject.h b/Include/frameobject.h index 0dc4d06..05877f9 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -51,7 +51,7 @@ typedef struct _frame { PyAPI_DATA(PyTypeObject) PyFrame_Type; -#define PyFrame_Check(op) (Py_Type(op) == &PyFrame_Type) +#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); diff --git a/Include/funcobject.h b/Include/funcobject.h index 798b257..058c6bf 100644 --- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -41,7 +41,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 ba1b482..851cd7b 100644 --- a/Include/iterobject.h +++ b/Include/iterobject.h @@ -10,12 +10,12 @@ PyAPI_DATA(PyTypeObject) PyCallIter_Type; PyAPI_DATA(PyTypeObject) PyZipIter_Type; PyAPI_DATA(PyTypeObject) PyCmpWrapper_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 *); -#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 *); diff --git a/Include/listobject.h b/Include/listobject.h index d395889..755fbbe 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -44,8 +44,8 @@ PyAPI_DATA(PyTypeObject) PyListRevIter_Type; PyAPI_DATA(PyTypeObject) PySortWrapper_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 *); @@ -63,7 +63,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 d48552c..18d0c55 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/memoryobject.h b/Include/memoryobject.h index 8709da5..ad2e8e7 100644 --- a/Include/memoryobject.h +++ b/Include/memoryobject.h @@ -16,7 +16,7 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyMemoryView_Type; -#define PyMemory_Check(op) (Py_Type(op) == &PyMemoryView_Type) +#define PyMemory_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) #define PyMemoryView(op) (((PyMemoryViewObject *)(op))->view) #define Py_END_OF_MEMORY (-1) diff --git a/Include/methodobject.h b/Include/methodobject.h index 0068120..48e780e 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 f50c729..d643ce2 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 942f801..d008c50 100644 --- a/Include/object.h +++ b/Include/object.h @@ -109,9 +109,9 @@ typedef struct { Py_ssize_t ob_size; /* Number of items in variable part */ } 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) /* Type objects contain a string containing the type name (to help somewhat @@ -404,21 +404,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); @@ -612,9 +612,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) @@ -639,13 +639,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 3f867e3..20d9c24 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -151,9 +151,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 ) @@ -228,8 +228,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) \ @@ -323,7 +323,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyType_SUPPORTS_WEAKREFS(t) ((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 23d9d16..3cb23cc 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 2746454..7e4dc28 100644 --- a/Include/rangeobject.h +++ b/Include/rangeobject.h @@ -19,7 +19,7 @@ PyAPI_DATA(PyTypeObject) PyRange_Type; PyAPI_DATA(PyTypeObject) PyRangeIter_Type; PyAPI_DATA(PyTypeObject) PyLongRangeIter_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 5b97fcb..5b7fb7e 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -67,13 +67,13 @@ PyAPI_DATA(PyTypeObject) PySetIter_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 6a63576..c1a5114 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -43,8 +43,8 @@ PyAPI_DATA(PyTypeObject) PyString_Type; PyAPI_DATA(PyTypeObject) PyStringIter_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 *); @@ -68,7 +68,7 @@ PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (assert(PyString_Check(op)), \ (((PyStringObject *)(op))->ob_sval)) -#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_Size(op)) +#define PyString_GET_SIZE(op) (assert(PyString_Check(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 12efd7f..8c1dc41 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -53,7 +53,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 7e9cdb5..018ef2f 100644 --- a/Include/tupleobject.h +++ b/Include/tupleobject.h @@ -35,8 +35,8 @@ PyAPI_DATA(PyTypeObject) PyTuple_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_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 *); @@ -48,7 +48,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 4e94f76..8a4e6a2 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -424,8 +424,8 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; #define SSTATE_INTERNED_IMMORTAL 2 #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 |