From 95c95ce5be8cf87e0e95ef285664aabda7ddd170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 22 Jul 2007 14:41:55 +0000 Subject: [PATCH] Merged revisions 56483-56491 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r56486 | kurt.kaiser | 2007-07-22 05:27:08 +0200 (So, 22 Jul 2007) | 2 lines Fix typo introduced at r55797 ........ r56487 | kurt.kaiser | 2007-07-22 07:48:45 +0200 (So, 22 Jul 2007) | 2 lines Exception attr accessed via args in py3k. ........ r56489 | martin.v.loewis | 2007-07-22 15:32:44 +0200 (So, 22 Jul 2007) | 2 lines Regenerate. ........ r56490 | martin.v.loewis | 2007-07-22 15:34:06 +0200 (So, 22 Jul 2007) | 2 lines Port Mac modules to PEP 3123. ........ r56491 | martin.v.loewis | 2007-07-22 16:35:53 +0200 (So, 22 Jul 2007) | 1 line Port to PEP 3123. ........ --- Lib/idlelib/CallTips.py | 2 +- Lib/idlelib/ScriptBinding.py | 4 +- Mac/Modules/MacOS.c | 5 +- Mac/Modules/ae/_AEmodule.c | 9 ++- Mac/Modules/app/_Appmodule.c | 9 ++- Mac/Modules/carbonevt/_CarbonEvtmodule.c | 56 ++++++++---------- Mac/Modules/cf/_CFmodule.c | 72 ++++++++++-------------- Mac/Modules/cg/_CGmodule.c | 9 ++- Mac/Modules/cm/_Cmmodule.c | 18 +++--- Mac/Modules/ctl/_Ctlmodule.c | 9 ++- Mac/Modules/dlg/_Dlgmodule.c | 9 ++- Mac/Modules/drag/_Dragmodule.c | 9 ++- Mac/Modules/file/_Filemodule.c | 43 +++++++------- Mac/Modules/ibcarbon/_IBCarbon.c | 9 ++- Mac/Modules/list/_Listmodule.c | 9 ++- Mac/Modules/menu/_Menumodule.c | 9 ++- Mac/Modules/mlte/_Mltemodule.c | 18 +++--- Mac/Modules/osa/_OSAmodule.c | 9 ++- Mac/Modules/qd/_Qdmodule.c | 18 +++--- Mac/Modules/qdoffs/_Qdoffsmodule.c | 9 ++- Mac/Modules/qt/_Qtmodule.c | 72 +++++++++++------------- Mac/Modules/res/_Resmodule.c | 9 ++- Mac/Modules/scrap/_Scrapmodule.c | 9 ++- Mac/Modules/snd/_Sndmodule.c | 14 ++--- Mac/Modules/te/_TEmodule.c | 9 ++- Mac/Modules/win/_Winmodule.c | 9 ++- PC/_subprocess.c | 7 +-- PC/_winreg.c | 2 +- 28 files changed, 205 insertions(+), 261 deletions(-) diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index 235e199f6e9..134491df645 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -138,7 +138,7 @@ def get_arg_text(ob): fob = lambda: None else: arg_offset = 1 - elif isinstace(ob, types.MethodType): + elif isinstance(ob, types.MethodType): # bit of a hack for methods - turn it into a function # but we drop the "self" param. fob = ob.im_func diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py index c8ae60bffa5..485de349332 100644 --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -99,13 +99,13 @@ class ScriptBinding: return compile(source, filename, "exec") except (SyntaxError, OverflowError) as err: try: - msg, (errorfilename, lineno, offset, line) = err + msg, (errorfilename, lineno, offset, line) = err.args if not errorfilename: err.args = msg, (filename, lineno, offset, line) err.filename = filename self.colorize_syntax_error(msg, lineno, offset) except: - msg = "*** " + str(err) + msg = str(err) self.errorbox("Syntax error", "There's an error in your program:\n" + msg) return False diff --git a/Mac/Modules/MacOS.c b/Mac/Modules/MacOS.c index 4eabb3951d9..434c547d1cc 100644 --- a/Mac/Modules/MacOS.c +++ b/Mac/Modules/MacOS.c @@ -257,8 +257,7 @@ static char Rftype__doc__[] = ; static PyTypeObject Rftype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(&PyType_Type, 0) "MacOS.ResourceFork", /*tp_name*/ sizeof(rfobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -610,7 +609,7 @@ initMacOS(void) MacOS_Error = PyMac_GetOSErrException(); if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0) return; - Rftype.ob_type = &PyType_Type; + Py_Type(&Rftype) = &PyType_Type; Py_INCREF(&Rftype); if (PyDict_SetItemString(d, "ResourceForkType", (PyObject *)&Rftype) != 0) return; diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c index fd6ebccdb25..de7c25eaf35 100644 --- a/Mac/Modules/ae/_AEmodule.c +++ b/Mac/Modules/ae/_AEmodule.c @@ -47,7 +47,7 @@ static PyObject *AE_Error; PyTypeObject AEDesc_Type; -#define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type)) +#define AEDesc_Check(x) (Py_Type(x) == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type)) typedef struct AEDescObject { PyObject_HEAD @@ -79,7 +79,7 @@ int AEDesc_Convert(PyObject *v, AEDesc *p_itself) static void AEDesc_dealloc(AEDescObject *self) { if (self->ob_owned) AEDisposeDesc(&self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args) @@ -878,8 +878,7 @@ static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject AEDesc_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_AE.AEDesc", /*tp_name*/ sizeof(AEDescObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1441,7 +1440,7 @@ void init_AE(void) if (AE_Error == NULL || PyDict_SetItemString(d, "Error", AE_Error) != 0) return; - AEDesc_Type.ob_type = &PyType_Type; + Py_Type(&AEDesc_Type) = &PyType_Type; if (PyType_Ready(&AEDesc_Type) < 0) return; Py_INCREF(&AEDesc_Type); PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type); diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c index 3a368bf10fd..6e0a38bae18 100644 --- a/Mac/Modules/app/_Appmodule.c +++ b/Mac/Modules/app/_Appmodule.c @@ -30,7 +30,7 @@ static PyObject *App_Error; PyTypeObject ThemeDrawingState_Type; -#define ThemeDrawingStateObj_Check(x) ((x)->ob_type == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type)) +#define ThemeDrawingStateObj_Check(x) (Py_Type(x) == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type)) typedef struct ThemeDrawingStateObject { PyObject_HEAD @@ -60,7 +60,7 @@ int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself) static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args) @@ -132,8 +132,7 @@ static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *_args PyTypeObject ThemeDrawingState_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_App.ThemeDrawingState", /*tp_name*/ sizeof(ThemeDrawingStateObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1808,7 +1807,7 @@ void init_App(void) if (App_Error == NULL || PyDict_SetItemString(d, "Error", App_Error) != 0) return; - ThemeDrawingState_Type.ob_type = &PyType_Type; + Py_Type(&ThemeDrawingState_Type) = &PyType_Type; if (PyType_Ready(&ThemeDrawingState_Type) < 0) return; Py_INCREF(&ThemeDrawingState_Type); PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type); diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c index fd4b266b8cb..7b44228e8ed 100755 --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c @@ -151,7 +151,7 @@ int EventRef_Convert(PyObject *v, EventRef *p_itself) static void EventRef_dealloc(EventRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventRef_RetainEvent(EventRefObject *_self, PyObject *_args) @@ -416,8 +416,7 @@ static PyObject *EventRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject * PyTypeObject EventRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventRef", /*tp_name*/ sizeof(EventRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -496,7 +495,7 @@ int EventQueueRef_Convert(PyObject *v, EventQueueRef *p_itself) static void EventQueueRef_dealloc(EventQueueRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventQueueRef_PostEventToQueue(EventQueueRefObject *_self, PyObject *_args) @@ -637,8 +636,7 @@ static PyObject *EventQueueRef_tp_new(PyTypeObject *type, PyObject *_args, PyObj PyTypeObject EventQueueRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventQueueRef", /*tp_name*/ sizeof(EventQueueRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -717,7 +715,7 @@ int EventLoopRef_Convert(PyObject *v, EventLoopRef *p_itself) static void EventLoopRef_dealloc(EventLoopRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventLoopRef_QuitEventLoop(EventLoopRefObject *_self, PyObject *_args) @@ -767,8 +765,7 @@ static PyObject *EventLoopRef_tp_new(PyTypeObject *type, PyObject *_args, PyObje PyTypeObject EventLoopRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventLoopRef", /*tp_name*/ sizeof(EventLoopRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -847,7 +844,7 @@ int EventLoopTimerRef_Convert(PyObject *v, EventLoopTimerRef *p_itself) static void EventLoopTimerRef_dealloc(EventLoopTimerRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventLoopTimerRef_RemoveEventLoopTimer(EventLoopTimerRefObject *_self, PyObject *_args) @@ -915,8 +912,7 @@ static PyObject *EventLoopTimerRef_tp_new(PyTypeObject *type, PyObject *_args, P PyTypeObject EventLoopTimerRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventLoopTimerRef", /*tp_name*/ sizeof(EventLoopTimerRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1000,7 +996,7 @@ static void EventHandlerRef_dealloc(EventHandlerRefObject *self) RemoveEventHandler(self->ob_itself); Py_DECREF(self->ob_callback); } - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventHandlerRef_AddEventTypesToHandler(EventHandlerRefObject *_self, PyObject *_args) @@ -1108,8 +1104,7 @@ static PyObject *EventHandlerRef_tp_new(PyTypeObject *type, PyObject *_args, PyO PyTypeObject EventHandlerRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventHandlerRef", /*tp_name*/ sizeof(EventHandlerRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1188,7 +1183,7 @@ int EventHandlerCallRef_Convert(PyObject *v, EventHandlerCallRef *p_itself) static void EventHandlerCallRef_dealloc(EventHandlerCallRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventHandlerCallRef_CallNextEventHandler(EventHandlerCallRefObject *_self, PyObject *_args) @@ -1241,8 +1236,7 @@ static PyObject *EventHandlerCallRef_tp_new(PyTypeObject *type, PyObject *_args, PyTypeObject EventHandlerCallRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventHandlerCallRef", /*tp_name*/ sizeof(EventHandlerCallRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1321,7 +1315,7 @@ int EventTargetRef_Convert(PyObject *v, EventTargetRef *p_itself) static void EventTargetRef_dealloc(EventTargetRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventTargetRef_InstallStandardEventHandler(EventTargetRefObject *_self, PyObject *_args) @@ -1396,8 +1390,7 @@ static PyObject *EventTargetRef_tp_new(PyTypeObject *type, PyObject *_args, PyOb PyTypeObject EventTargetRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventTargetRef", /*tp_name*/ sizeof(EventTargetRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1476,7 +1469,7 @@ int EventHotKeyRef_Convert(PyObject *v, EventHotKeyRef *p_itself) static void EventHotKeyRef_dealloc(EventHotKeyRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *EventHotKeyRef_UnregisterEventHotKey(EventHotKeyRefObject *_self, PyObject *_args) @@ -1526,8 +1519,7 @@ static PyObject *EventHotKeyRef_tp_new(PyTypeObject *type, PyObject *_args, PyOb PyTypeObject EventHotKeyRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CarbonEvt.EventHotKeyRef", /*tp_name*/ sizeof(EventHotKeyRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -2160,56 +2152,56 @@ void init_CarbonEvt(void) if (CarbonEvents_Error == NULL || PyDict_SetItemString(d, "Error", CarbonEvents_Error) != 0) return; - EventRef_Type.ob_type = &PyType_Type; + Py_Type(&EventRef_Type) = &PyType_Type; if (PyType_Ready(&EventRef_Type) < 0) return; Py_INCREF(&EventRef_Type); PyModule_AddObject(m, "EventRef", (PyObject *)&EventRef_Type); /* Backward-compatible name */ Py_INCREF(&EventRef_Type); PyModule_AddObject(m, "EventRefType", (PyObject *)&EventRef_Type); - EventQueueRef_Type.ob_type = &PyType_Type; + Py_Type(&EventQueueRef_Type) = &PyType_Type; if (PyType_Ready(&EventQueueRef_Type) < 0) return; Py_INCREF(&EventQueueRef_Type); PyModule_AddObject(m, "EventQueueRef", (PyObject *)&EventQueueRef_Type); /* Backward-compatible name */ Py_INCREF(&EventQueueRef_Type); PyModule_AddObject(m, "EventQueueRefType", (PyObject *)&EventQueueRef_Type); - EventLoopRef_Type.ob_type = &PyType_Type; + Py_Type(&EventLoopRef_Type) = &PyType_Type; if (PyType_Ready(&EventLoopRef_Type) < 0) return; Py_INCREF(&EventLoopRef_Type); PyModule_AddObject(m, "EventLoopRef", (PyObject *)&EventLoopRef_Type); /* Backward-compatible name */ Py_INCREF(&EventLoopRef_Type); PyModule_AddObject(m, "EventLoopRefType", (PyObject *)&EventLoopRef_Type); - EventLoopTimerRef_Type.ob_type = &PyType_Type; + Py_Type(&EventLoopTimerRef_Type) = &PyType_Type; if (PyType_Ready(&EventLoopTimerRef_Type) < 0) return; Py_INCREF(&EventLoopTimerRef_Type); PyModule_AddObject(m, "EventLoopTimerRef", (PyObject *)&EventLoopTimerRef_Type); /* Backward-compatible name */ Py_INCREF(&EventLoopTimerRef_Type); PyModule_AddObject(m, "EventLoopTimerRefType", (PyObject *)&EventLoopTimerRef_Type); - EventHandlerRef_Type.ob_type = &PyType_Type; + Py_Type(&EventHandlerRef_Type) = &PyType_Type; if (PyType_Ready(&EventHandlerRef_Type) < 0) return; Py_INCREF(&EventHandlerRef_Type); PyModule_AddObject(m, "EventHandlerRef", (PyObject *)&EventHandlerRef_Type); /* Backward-compatible name */ Py_INCREF(&EventHandlerRef_Type); PyModule_AddObject(m, "EventHandlerRefType", (PyObject *)&EventHandlerRef_Type); - EventHandlerCallRef_Type.ob_type = &PyType_Type; + Py_Type(&EventHandlerCallRef_Type) = &PyType_Type; if (PyType_Ready(&EventHandlerCallRef_Type) < 0) return; Py_INCREF(&EventHandlerCallRef_Type); PyModule_AddObject(m, "EventHandlerCallRef", (PyObject *)&EventHandlerCallRef_Type); /* Backward-compatible name */ Py_INCREF(&EventHandlerCallRef_Type); PyModule_AddObject(m, "EventHandlerCallRefType", (PyObject *)&EventHandlerCallRef_Type); - EventTargetRef_Type.ob_type = &PyType_Type; + Py_Type(&EventTargetRef_Type) = &PyType_Type; if (PyType_Ready(&EventTargetRef_Type) < 0) return; Py_INCREF(&EventTargetRef_Type); PyModule_AddObject(m, "EventTargetRef", (PyObject *)&EventTargetRef_Type); /* Backward-compatible name */ Py_INCREF(&EventTargetRef_Type); PyModule_AddObject(m, "EventTargetRefType", (PyObject *)&EventTargetRef_Type); - EventHotKeyRef_Type.ob_type = &PyType_Type; + Py_Type(&EventHotKeyRef_Type) = &PyType_Type; if (PyType_Ready(&EventHotKeyRef_Type) < 0) return; Py_INCREF(&EventHotKeyRef_Type); PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type); diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 8d780224e5e..da925643153 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -116,7 +116,7 @@ static PyObject *CF_Error; PyTypeObject CFTypeRef_Type; -#define CFTypeRefObj_Check(x) ((x)->ob_type == &CFTypeRef_Type || PyObject_TypeCheck((x), &CFTypeRef_Type)) +#define CFTypeRefObj_Check(x) (Py_Type(x) == &CFTypeRef_Type || PyObject_TypeCheck((x), &CFTypeRef_Type)) typedef struct CFTypeRefObject { PyObject_HEAD @@ -161,7 +161,7 @@ static void CFTypeRefObj_dealloc(CFTypeRefObject *self) self->ob_freeit((CFTypeRef)self->ob_itself); self->ob_itself = NULL; } - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *CFTypeRefObj_CFGetTypeID(CFTypeRefObject *_self, PyObject *_args) @@ -428,8 +428,7 @@ static PyObject *CFTypeRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObje PyTypeObject CFTypeRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFTypeRef", /*tp_name*/ sizeof(CFTypeRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -478,7 +477,7 @@ PyTypeObject CFTypeRef_Type = { PyTypeObject CFArrayRef_Type; -#define CFArrayRefObj_Check(x) ((x)->ob_type == &CFArrayRef_Type || PyObject_TypeCheck((x), &CFArrayRef_Type)) +#define CFArrayRefObj_Check(x) (Py_Type(x) == &CFArrayRef_Type || PyObject_TypeCheck((x), &CFArrayRef_Type)) typedef struct CFArrayRefObject { PyObject_HEAD @@ -639,8 +638,7 @@ static PyObject *CFArrayRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObj PyTypeObject CFArrayRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFArrayRef", /*tp_name*/ sizeof(CFArrayRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -689,7 +687,7 @@ PyTypeObject CFArrayRef_Type = { PyTypeObject CFMutableArrayRef_Type; -#define CFMutableArrayRefObj_Check(x) ((x)->ob_type == &CFMutableArrayRef_Type || PyObject_TypeCheck((x), &CFMutableArrayRef_Type)) +#define CFMutableArrayRefObj_Check(x) (Py_Type(x) == &CFMutableArrayRef_Type || PyObject_TypeCheck((x), &CFMutableArrayRef_Type)) typedef struct CFMutableArrayRefObject { PyObject_HEAD @@ -879,8 +877,7 @@ static PyObject *CFMutableArrayRefObj_tp_new(PyTypeObject *type, PyObject *_args PyTypeObject CFMutableArrayRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFMutableArrayRef", /*tp_name*/ sizeof(CFMutableArrayRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -929,7 +926,7 @@ PyTypeObject CFMutableArrayRef_Type = { PyTypeObject CFDictionaryRef_Type; -#define CFDictionaryRefObj_Check(x) ((x)->ob_type == &CFDictionaryRef_Type || PyObject_TypeCheck((x), &CFDictionaryRef_Type)) +#define CFDictionaryRefObj_Check(x) (Py_Type(x) == &CFDictionaryRef_Type || PyObject_TypeCheck((x), &CFDictionaryRef_Type)) typedef struct CFDictionaryRefObject { PyObject_HEAD @@ -1072,8 +1069,7 @@ static PyObject *CFDictionaryRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyTypeObject CFDictionaryRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFDictionaryRef", /*tp_name*/ sizeof(CFDictionaryRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1122,7 +1118,7 @@ PyTypeObject CFDictionaryRef_Type = { PyTypeObject CFMutableDictionaryRef_Type; -#define CFMutableDictionaryRefObj_Check(x) ((x)->ob_type == &CFMutableDictionaryRef_Type || PyObject_TypeCheck((x), &CFMutableDictionaryRef_Type)) +#define CFMutableDictionaryRefObj_Check(x) (Py_Type(x) == &CFMutableDictionaryRef_Type || PyObject_TypeCheck((x), &CFMutableDictionaryRef_Type)) typedef struct CFMutableDictionaryRefObject { PyObject_HEAD @@ -1249,8 +1245,7 @@ static PyObject *CFMutableDictionaryRefObj_tp_new(PyTypeObject *type, PyObject * PyTypeObject CFMutableDictionaryRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFMutableDictionaryRef", /*tp_name*/ sizeof(CFMutableDictionaryRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1299,7 +1294,7 @@ PyTypeObject CFMutableDictionaryRef_Type = { PyTypeObject CFDataRef_Type; -#define CFDataRefObj_Check(x) ((x)->ob_type == &CFDataRef_Type || PyObject_TypeCheck((x), &CFDataRef_Type)) +#define CFDataRefObj_Check(x) (Py_Type(x) == &CFDataRef_Type || PyObject_TypeCheck((x), &CFDataRef_Type)) typedef struct CFDataRefObject { PyObject_HEAD @@ -1480,8 +1475,7 @@ static PyObject *CFDataRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObje PyTypeObject CFDataRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFDataRef", /*tp_name*/ sizeof(CFDataRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1530,7 +1524,7 @@ PyTypeObject CFDataRef_Type = { PyTypeObject CFMutableDataRef_Type; -#define CFMutableDataRefObj_Check(x) ((x)->ob_type == &CFMutableDataRef_Type || PyObject_TypeCheck((x), &CFMutableDataRef_Type)) +#define CFMutableDataRefObj_Check(x) (Py_Type(x) == &CFMutableDataRef_Type || PyObject_TypeCheck((x), &CFMutableDataRef_Type)) typedef struct CFMutableDataRefObject { PyObject_HEAD @@ -1745,8 +1739,7 @@ static PyObject *CFMutableDataRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyTypeObject CFMutableDataRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFMutableDataRef", /*tp_name*/ sizeof(CFMutableDataRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1795,7 +1788,7 @@ PyTypeObject CFMutableDataRef_Type = { PyTypeObject CFStringRef_Type; -#define CFStringRefObj_Check(x) ((x)->ob_type == &CFStringRef_Type || PyObject_TypeCheck((x), &CFStringRef_Type)) +#define CFStringRefObj_Check(x) (Py_Type(x) == &CFStringRef_Type || PyObject_TypeCheck((x), &CFStringRef_Type)) typedef struct CFStringRefObject { PyObject_HEAD @@ -2487,8 +2480,7 @@ static PyObject *CFStringRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyOb PyTypeObject CFStringRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFStringRef", /*tp_name*/ sizeof(CFStringRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -2537,7 +2529,7 @@ PyTypeObject CFStringRef_Type = { PyTypeObject CFMutableStringRef_Type; -#define CFMutableStringRefObj_Check(x) ((x)->ob_type == &CFMutableStringRef_Type || PyObject_TypeCheck((x), &CFMutableStringRef_Type)) +#define CFMutableStringRefObj_Check(x) (Py_Type(x) == &CFMutableStringRef_Type || PyObject_TypeCheck((x), &CFMutableStringRef_Type)) typedef struct CFMutableStringRefObject { PyObject_HEAD @@ -2875,8 +2867,7 @@ static PyObject *CFMutableStringRefObj_tp_new(PyTypeObject *type, PyObject *_arg PyTypeObject CFMutableStringRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFMutableStringRef", /*tp_name*/ sizeof(CFMutableStringRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -2925,7 +2916,7 @@ PyTypeObject CFMutableStringRef_Type = { PyTypeObject CFURLRef_Type; -#define CFURLRefObj_Check(x) ((x)->ob_type == &CFURLRef_Type || PyObject_TypeCheck((x), &CFURLRef_Type)) +#define CFURLRefObj_Check(x) (Py_Type(x) == &CFURLRef_Type || PyObject_TypeCheck((x), &CFURLRef_Type)) typedef struct CFURLRefObject { PyObject_HEAD @@ -3527,8 +3518,7 @@ static PyObject *CFURLRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject CFURLRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CF.CFURLRef", /*tp_name*/ sizeof(CFURLRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -4899,14 +4889,14 @@ void init_CF(void) if (CF_Error == NULL || PyDict_SetItemString(d, "Error", CF_Error) != 0) return; - CFTypeRef_Type.ob_type = &PyType_Type; + Py_Type(&CFTypeRef_Type) = &PyType_Type; if (PyType_Ready(&CFTypeRef_Type) < 0) return; Py_INCREF(&CFTypeRef_Type); PyModule_AddObject(m, "CFTypeRef", (PyObject *)&CFTypeRef_Type); /* Backward-compatible name */ Py_INCREF(&CFTypeRef_Type); PyModule_AddObject(m, "CFTypeRefType", (PyObject *)&CFTypeRef_Type); - CFArrayRef_Type.ob_type = &PyType_Type; + Py_Type(&CFArrayRef_Type) = &PyType_Type; CFArrayRef_Type.tp_base = &CFTypeRef_Type; if (PyType_Ready(&CFArrayRef_Type) < 0) return; Py_INCREF(&CFArrayRef_Type); @@ -4914,7 +4904,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFArrayRef_Type); PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type); - CFMutableArrayRef_Type.ob_type = &PyType_Type; + Py_Type(&CFMutableArrayRef_Type) = &PyType_Type; CFMutableArrayRef_Type.tp_base = &CFArrayRef_Type; if (PyType_Ready(&CFMutableArrayRef_Type) < 0) return; Py_INCREF(&CFMutableArrayRef_Type); @@ -4922,7 +4912,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFMutableArrayRef_Type); PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type); - CFDictionaryRef_Type.ob_type = &PyType_Type; + Py_Type(&CFDictionaryRef_Type) = &PyType_Type; CFDictionaryRef_Type.tp_base = &CFTypeRef_Type; if (PyType_Ready(&CFDictionaryRef_Type) < 0) return; Py_INCREF(&CFDictionaryRef_Type); @@ -4930,7 +4920,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFDictionaryRef_Type); PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type); - CFMutableDictionaryRef_Type.ob_type = &PyType_Type; + Py_Type(&CFMutableDictionaryRef_Type) = &PyType_Type; CFMutableDictionaryRef_Type.tp_base = &CFDictionaryRef_Type; if (PyType_Ready(&CFMutableDictionaryRef_Type) < 0) return; Py_INCREF(&CFMutableDictionaryRef_Type); @@ -4938,7 +4928,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFMutableDictionaryRef_Type); PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type); - CFDataRef_Type.ob_type = &PyType_Type; + Py_Type(&CFDataRef_Type) = &PyType_Type; CFDataRef_Type.tp_base = &CFTypeRef_Type; if (PyType_Ready(&CFDataRef_Type) < 0) return; Py_INCREF(&CFDataRef_Type); @@ -4946,7 +4936,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFDataRef_Type); PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type); - CFMutableDataRef_Type.ob_type = &PyType_Type; + Py_Type(&CFMutableDataRef_Type) = &PyType_Type; CFMutableDataRef_Type.tp_base = &CFDataRef_Type; if (PyType_Ready(&CFMutableDataRef_Type) < 0) return; Py_INCREF(&CFMutableDataRef_Type); @@ -4954,7 +4944,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFMutableDataRef_Type); PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type); - CFStringRef_Type.ob_type = &PyType_Type; + Py_Type(&CFStringRef_Type) = &PyType_Type; CFStringRef_Type.tp_base = &CFTypeRef_Type; if (PyType_Ready(&CFStringRef_Type) < 0) return; Py_INCREF(&CFStringRef_Type); @@ -4962,7 +4952,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFStringRef_Type); PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type); - CFMutableStringRef_Type.ob_type = &PyType_Type; + Py_Type(&CFMutableStringRef_Type) = &PyType_Type; CFMutableStringRef_Type.tp_base = &CFStringRef_Type; if (PyType_Ready(&CFMutableStringRef_Type) < 0) return; Py_INCREF(&CFMutableStringRef_Type); @@ -4970,7 +4960,7 @@ void init_CF(void) /* Backward-compatible name */ Py_INCREF(&CFMutableStringRef_Type); PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type); - CFURLRef_Type.ob_type = &PyType_Type; + Py_Type(&CFURLRef_Type) = &PyType_Type; CFURLRef_Type.tp_base = &CFTypeRef_Type; if (PyType_Ready(&CFURLRef_Type) < 0) return; Py_INCREF(&CFURLRef_Type); diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c index 81156149c72..bcfe7b03557 100755 --- a/Mac/Modules/cg/_CGmodule.c +++ b/Mac/Modules/cg/_CGmodule.c @@ -95,7 +95,7 @@ static PyObject *CG_Error; PyTypeObject CGContextRef_Type; -#define CGContextRefObj_Check(x) ((x)->ob_type == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type)) +#define CGContextRefObj_Check(x) (Py_Type(x) == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type)) typedef struct CGContextRefObject { PyObject_HEAD @@ -125,7 +125,7 @@ int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself) static void CGContextRefObj_dealloc(CGContextRefObject *self) { CGContextRelease(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args) @@ -1208,8 +1208,7 @@ static PyObject *CGContextRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyO PyTypeObject CGContextRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_CG.CGContextRef", /*tp_name*/ sizeof(CGContextRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1295,7 +1294,7 @@ void init_CG(void) if (CG_Error == NULL || PyDict_SetItemString(d, "Error", CG_Error) != 0) return; - CGContextRef_Type.ob_type = &PyType_Type; + Py_Type(&CGContextRef_Type) = &PyType_Type; if (PyType_Ready(&CGContextRef_Type) < 0) return; Py_INCREF(&CGContextRef_Type); PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type); diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c index 3c6be6b9366..9c74482a6c6 100644 --- a/Mac/Modules/cm/_Cmmodule.c +++ b/Mac/Modules/cm/_Cmmodule.c @@ -60,7 +60,7 @@ static PyObject *Cm_Error; PyTypeObject ComponentInstance_Type; -#define CmpInstObj_Check(x) ((x)->ob_type == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type)) +#define CmpInstObj_Check(x) (Py_Type(x) == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type)) typedef struct ComponentInstanceObject { PyObject_HEAD @@ -94,7 +94,7 @@ int CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself) static void CmpInstObj_dealloc(ComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args) @@ -277,8 +277,7 @@ static PyObject *CmpInstObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject PyTypeObject ComponentInstance_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Cm.ComponentInstance", /*tp_name*/ sizeof(ComponentInstanceObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -327,7 +326,7 @@ PyTypeObject ComponentInstance_Type = { PyTypeObject Component_Type; -#define CmpObj_Check(x) ((x)->ob_type == &Component_Type || PyObject_TypeCheck((x), &Component_Type)) +#define CmpObj_Check(x) (Py_Type(x) == &Component_Type || PyObject_TypeCheck((x), &Component_Type)) typedef struct ComponentObject { PyObject_HEAD @@ -366,7 +365,7 @@ int CmpObj_Convert(PyObject *v, Component *p_itself) static void CmpObj_dealloc(ComponentObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args) @@ -711,8 +710,7 @@ static PyObject *CmpObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject Component_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Cm.Component", /*tp_name*/ sizeof(ComponentObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -927,14 +925,14 @@ void init_Cm(void) if (Cm_Error == NULL || PyDict_SetItemString(d, "Error", Cm_Error) != 0) return; - ComponentInstance_Type.ob_type = &PyType_Type; + Py_Type(&ComponentInstance_Type) = &PyType_Type; if (PyType_Ready(&ComponentInstance_Type) < 0) return; Py_INCREF(&ComponentInstance_Type); PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type); /* Backward-compatible name */ Py_INCREF(&ComponentInstance_Type); PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type); - Component_Type.ob_type = &PyType_Type; + Py_Type(&Component_Type) = &PyType_Type; if (PyType_Ready(&Component_Type) < 0) return; Py_INCREF(&Component_Type); PyModule_AddObject(m, "Component", (PyObject *)&Component_Type); diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index c6287e05175..4880dee3f67 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -135,7 +135,7 @@ static PyObject *Ctl_Error; PyTypeObject Control_Type; -#define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type)) +#define CtlObj_Check(x) (Py_Type(x) == &Control_Type || PyObject_TypeCheck((x), &Control_Type)) typedef struct ControlObject { PyObject_HEAD @@ -170,7 +170,7 @@ static void CtlObj_dealloc(ControlObject *self) { Py_XDECREF(self->ob_callbackdict); if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args) @@ -3865,8 +3865,7 @@ static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject Control_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Ctl.Control", /*tp_name*/ sizeof(ControlObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -5791,7 +5790,7 @@ void init_Ctl(void) if (Ctl_Error == NULL || PyDict_SetItemString(d, "Error", Ctl_Error) != 0) return; - Control_Type.ob_type = &PyType_Type; + Py_Type(&Control_Type) = &PyType_Type; if (PyType_Ready(&Control_Type) < 0) return; Py_INCREF(&Control_Type); PyModule_AddObject(m, "Control", (PyObject *)&Control_Type); diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c index 46009a8c67a..473a449b960 100644 --- a/Mac/Modules/dlg/_Dlgmodule.c +++ b/Mac/Modules/dlg/_Dlgmodule.c @@ -129,7 +129,7 @@ static PyObject *Dlg_Error; PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type || PyObject_TypeCheck((x), &Dialog_Type)) +#define DlgObj_Check(x) (Py_Type(x) == &Dialog_Type || PyObject_TypeCheck((x), &Dialog_Type)) typedef struct DialogObject { PyObject_HEAD @@ -164,7 +164,7 @@ int DlgObj_Convert(PyObject *v, DialogPtr *p_itself) static void DlgObj_dealloc(DialogObject *self) { DisposeDialog(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args) @@ -975,8 +975,7 @@ static PyObject *DlgObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject Dialog_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Dlg.Dialog", /*tp_name*/ sizeof(DialogObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1583,7 +1582,7 @@ void init_Dlg(void) if (Dlg_Error == NULL || PyDict_SetItemString(d, "Error", Dlg_Error) != 0) return; - Dialog_Type.ob_type = &PyType_Type; + Py_Type(&Dialog_Type) = &PyType_Type; if (PyType_Ready(&Dialog_Type) < 0) return; Py_INCREF(&Dialog_Type); PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type); diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c index 180fcab2f87..5c037034b36 100644 --- a/Mac/Modules/drag/_Dragmodule.c +++ b/Mac/Modules/drag/_Dragmodule.c @@ -40,7 +40,7 @@ static PyObject *Drag_Error; PyTypeObject DragObj_Type; -#define DragObj_Check(x) ((x)->ob_type == &DragObj_Type || PyObject_TypeCheck((x), &DragObj_Type)) +#define DragObj_Check(x) (Py_Type(x) == &DragObj_Type || PyObject_TypeCheck((x), &DragObj_Type)) typedef struct DragObjObject { PyObject_HEAD @@ -76,7 +76,7 @@ int DragObj_Convert(PyObject *v, DragRef *p_itself) static void DragObj_dealloc(DragObjObject *self) { Py_XDECREF(self->sendproc); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args) @@ -760,8 +760,7 @@ static PyObject *DragObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_ PyTypeObject DragObj_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Drag.DragObj", /*tp_name*/ sizeof(DragObjObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1126,7 +1125,7 @@ void init_Drag(void) if (Drag_Error == NULL || PyDict_SetItemString(d, "Error", Drag_Error) != 0) return; - DragObj_Type.ob_type = &PyType_Type; + Py_Type(&DragObj_Type) = &PyType_Type; if (PyType_Ready(&DragObj_Type) < 0) return; Py_INCREF(&DragObj_Type); PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type); diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index 768f1a24d9f..ce4049f9a59 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -143,7 +143,7 @@ static PyObject *File_Error; static PyTypeObject FSCatalogInfo_Type; -#define FSCatalogInfo_Check(x) ((x)->ob_type == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type)) +#define FSCatalogInfo_Check(x) (Py_Type(x) == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type)) typedef struct FSCatalogInfoObject { PyObject_HEAD @@ -174,7 +174,7 @@ static int FSCatalogInfo_Convert(PyObject *v, FSCatalogInfo *p_itself) static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyMethodDef FSCatalogInfo_methods[] = { @@ -453,8 +453,7 @@ static PyObject *FSCatalogInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObj static PyTypeObject FSCatalogInfo_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "Carbon.File.FSCatalogInfo", /*tp_name*/ sizeof(FSCatalogInfoObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -503,7 +502,7 @@ static PyTypeObject FSCatalogInfo_Type = { static PyTypeObject FInfo_Type; -#define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) +#define FInfo_Check(x) (Py_Type(x) == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) typedef struct FInfoObject { PyObject_HEAD @@ -534,7 +533,7 @@ static int FInfo_Convert(PyObject *v, FInfo *p_itself) static void FInfo_dealloc(FInfoObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyMethodDef FInfo_methods[] = { @@ -639,8 +638,7 @@ static PyObject *FInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kw static PyTypeObject FInfo_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "Carbon.File.FInfo", /*tp_name*/ sizeof(FInfoObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -689,7 +687,7 @@ static PyTypeObject FInfo_Type = { static PyTypeObject Alias_Type; -#define Alias_Check(x) ((x)->ob_type == &Alias_Type || PyObject_TypeCheck((x), &Alias_Type)) +#define Alias_Check(x) (Py_Type(x) == &Alias_Type || PyObject_TypeCheck((x), &Alias_Type)) typedef struct AliasObject { PyObject_HEAD @@ -726,7 +724,7 @@ static void Alias_dealloc(AliasObject *self) self->ob_freeit(self->ob_itself); } self->ob_itself = NULL; - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args) @@ -986,8 +984,7 @@ static PyObject *Alias_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kw static PyTypeObject Alias_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "Carbon.File.Alias", /*tp_name*/ sizeof(AliasObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1056,7 +1053,7 @@ static PyObject *FSSpec_New(FSSpec *itself) static void FSSpec_dealloc(FSSpecObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *FSSpec_FSpOpenDF(FSSpecObject *_self, PyObject *_args) @@ -1389,7 +1386,7 @@ static PyObject * FSSpec_repr(FSSpecObject *self) { char buf[512]; PyOS_snprintf(buf, sizeof(buf), "%s((%d, %ld, '%.*s'))", - self->ob_type->tp_name, + Py_Type(self)->tp_name, self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); @@ -1445,8 +1442,7 @@ static PyObject *FSSpec_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k static PyTypeObject FSSpec_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "Carbon.File.FSSpec", /*tp_name*/ sizeof(FSSpecObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1515,7 +1511,7 @@ static PyObject *FSRef_New(FSRef *itself) static void FSRef_dealloc(FSRefObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *FSRef_FSMakeFSRefUnicode(FSRefObject *_self, PyObject *_args) @@ -1989,8 +1985,7 @@ static PyObject *FSRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kw static PyTypeObject FSRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "Carbon.File.FSRef", /*tp_name*/ sizeof(FSRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -3255,35 +3250,35 @@ void init_File(void) if (File_Error == NULL || PyDict_SetItemString(d, "Error", File_Error) != 0) return; - FSCatalogInfo_Type.ob_type = &PyType_Type; + Py_Type(&FSCatalogInfo_Type) = &PyType_Type; if (PyType_Ready(&FSCatalogInfo_Type) < 0) return; Py_INCREF(&FSCatalogInfo_Type); PyModule_AddObject(m, "FSCatalogInfo", (PyObject *)&FSCatalogInfo_Type); /* Backward-compatible name */ Py_INCREF(&FSCatalogInfo_Type); PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type); - FInfo_Type.ob_type = &PyType_Type; + Py_Type(&FInfo_Type) = &PyType_Type; if (PyType_Ready(&FInfo_Type) < 0) return; Py_INCREF(&FInfo_Type); PyModule_AddObject(m, "FInfo", (PyObject *)&FInfo_Type); /* Backward-compatible name */ Py_INCREF(&FInfo_Type); PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type); - Alias_Type.ob_type = &PyType_Type; + Py_Type(&Alias_Type) = &PyType_Type; if (PyType_Ready(&Alias_Type) < 0) return; Py_INCREF(&Alias_Type); PyModule_AddObject(m, "Alias", (PyObject *)&Alias_Type); /* Backward-compatible name */ Py_INCREF(&Alias_Type); PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type); - FSSpec_Type.ob_type = &PyType_Type; + Py_Type(&FSSpec_Type) = &PyType_Type; if (PyType_Ready(&FSSpec_Type) < 0) return; Py_INCREF(&FSSpec_Type); PyModule_AddObject(m, "FSSpec", (PyObject *)&FSSpec_Type); /* Backward-compatible name */ Py_INCREF(&FSSpec_Type); PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type); - FSRef_Type.ob_type = &PyType_Type; + Py_Type(&FSRef_Type) = &PyType_Type; if (PyType_Ready(&FSRef_Type) < 0) return; Py_INCREF(&FSRef_Type); PyModule_AddObject(m, "FSRef", (PyObject *)&FSRef_Type); diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c index 6baad7c0c2e..72b17b343a1 100644 --- a/Mac/Modules/ibcarbon/_IBCarbon.c +++ b/Mac/Modules/ibcarbon/_IBCarbon.c @@ -19,7 +19,7 @@ static PyObject *IBCarbon_Error; PyTypeObject IBNibRef_Type; -#define IBNibRefObj_Check(x) ((x)->ob_type == &IBNibRef_Type || PyObject_TypeCheck((x), &IBNibRef_Type)) +#define IBNibRefObj_Check(x) (Py_Type(x) == &IBNibRef_Type || PyObject_TypeCheck((x), &IBNibRef_Type)) typedef struct IBNibRefObject { PyObject_HEAD @@ -49,7 +49,7 @@ int IBNibRefObj_Convert(PyObject *v, IBNibRef *p_itself) static void IBNibRefObj_dealloc(IBNibRefObject *self) { DisposeNibReference(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *IBNibRefObj_CreateWindowFromNib(IBNibRefObject *_self, PyObject *_args) @@ -162,8 +162,7 @@ static PyObject *IBNibRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject IBNibRef_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_IBCarbon.IBNibRef", /*tp_name*/ sizeof(IBNibRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -249,7 +248,7 @@ void init_IBCarbon(void) if (IBCarbon_Error == NULL || PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0) return; - IBNibRef_Type.ob_type = &PyType_Type; + Py_Type(&IBNibRef_Type) = &PyType_Type; if (PyType_Ready(&IBNibRef_Type) < 0) return; Py_INCREF(&IBNibRef_Type); PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type); diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c index 21a7f02f686..aa134908341 100644 --- a/Mac/Modules/list/_Listmodule.c +++ b/Mac/Modules/list/_Listmodule.c @@ -37,7 +37,7 @@ static PyObject *List_Error; PyTypeObject List_Type; -#define ListObj_Check(x) ((x)->ob_type == &List_Type || PyObject_TypeCheck((x), &List_Type)) +#define ListObj_Check(x) (Py_Type(x) == &List_Type || PyObject_TypeCheck((x), &List_Type)) typedef struct ListObject { PyObject_HEAD @@ -79,7 +79,7 @@ static void ListObj_dealloc(ListObject *self) self->ob_ldef_func = NULL; SetListRefCon(self->ob_itself, (long)0); if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args) @@ -755,8 +755,7 @@ static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_ PyTypeObject List_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_List.List", /*tp_name*/ sizeof(ListObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1117,7 +1116,7 @@ void init_List(void) if (List_Error == NULL || PyDict_SetItemString(d, "Error", List_Error) != 0) return; - List_Type.ob_type = &PyType_Type; + Py_Type(&List_Type) = &PyType_Type; if (PyType_Ready(&List_Type) < 0) return; Py_INCREF(&List_Type); PyModule_AddObject(m, "List", (PyObject *)&List_Type); diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c index e6a7f2f244f..3e0dfd85c89 100644 --- a/Mac/Modules/menu/_Menumodule.c +++ b/Mac/Modules/menu/_Menumodule.c @@ -57,7 +57,7 @@ static PyObject *Menu_Error; PyTypeObject Menu_Type; -#define MenuObj_Check(x) ((x)->ob_type == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type)) +#define MenuObj_Check(x) (Py_Type(x) == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type)) typedef struct MenuObject { PyObject_HEAD @@ -87,7 +87,7 @@ int MenuObj_Convert(PyObject *v, MenuHandle *p_itself) static void MenuObj_dealloc(MenuObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args) @@ -2553,8 +2553,7 @@ static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_ PyTypeObject Menu_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Menu.Menu", /*tp_name*/ sizeof(MenuObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -3456,7 +3455,7 @@ void init_Menu(void) if (Menu_Error == NULL || PyDict_SetItemString(d, "Error", Menu_Error) != 0) return; - Menu_Type.ob_type = &PyType_Type; + Py_Type(&Menu_Type) = &PyType_Type; if (PyType_Ready(&Menu_Type) < 0) return; Py_INCREF(&Menu_Type); PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type); diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c index a79b257d765..748139ed446 100644 --- a/Mac/Modules/mlte/_Mltemodule.c +++ b/Mac/Modules/mlte/_Mltemodule.c @@ -69,7 +69,7 @@ static PyObject *Mlte_Error; PyTypeObject TXNObject_Type; -#define TXNObj_Check(x) ((x)->ob_type == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type)) +#define TXNObj_Check(x) (Py_Type(x) == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type)) typedef struct TXNObjectObject { PyObject_HEAD @@ -100,7 +100,7 @@ int TXNObj_Convert(PyObject *v, TXNObject *p_itself) static void TXNObj_dealloc(TXNObjectObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args) @@ -1255,8 +1255,7 @@ static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject TXNObject_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Mlte.TXNObject", /*tp_name*/ sizeof(TXNObjectObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1305,7 +1304,7 @@ PyTypeObject TXNObject_Type = { PyTypeObject TXNFontMenuObject_Type; -#define TXNFontMenuObj_Check(x) ((x)->ob_type == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type)) +#define TXNFontMenuObj_Check(x) (Py_Type(x) == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type)) typedef struct TXNFontMenuObjectObject { PyObject_HEAD @@ -1336,7 +1335,7 @@ int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself) static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args) @@ -1409,8 +1408,7 @@ static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyOb PyTypeObject TXNFontMenuObject_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Mlte.TXNFontMenuObject", /*tp_name*/ sizeof(TXNFontMenuObjectObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1661,14 +1659,14 @@ void init_Mlte(void) if (Mlte_Error == NULL || PyDict_SetItemString(d, "Error", Mlte_Error) != 0) return; - TXNObject_Type.ob_type = &PyType_Type; + Py_Type(&TXNObject_Type) = &PyType_Type; if (PyType_Ready(&TXNObject_Type) < 0) return; Py_INCREF(&TXNObject_Type); PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type); /* Backward-compatible name */ Py_INCREF(&TXNObject_Type); PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type); - TXNFontMenuObject_Type.ob_type = &PyType_Type; + Py_Type(&TXNFontMenuObject_Type) = &PyType_Type; if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return; Py_INCREF(&TXNFontMenuObject_Type); PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type); diff --git a/Mac/Modules/osa/_OSAmodule.c b/Mac/Modules/osa/_OSAmodule.c index fca4f9b6aec..45be617a4c2 100644 --- a/Mac/Modules/osa/_OSAmodule.c +++ b/Mac/Modules/osa/_OSAmodule.c @@ -34,7 +34,7 @@ static PyObject *OSA_Error; PyTypeObject OSAComponentInstance_Type; -#define OSAObj_Check(x) ((x)->ob_type == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type)) +#define OSAObj_Check(x) (Py_Type(x) == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type)) typedef struct OSAComponentInstanceObject { PyObject_HEAD @@ -73,7 +73,7 @@ int OSAObj_Convert(PyObject *v, ComponentInstance *p_itself) static void OSAObj_dealloc(OSAComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *OSAObj_OSALoad(OSAComponentInstanceObject *_self, PyObject *_args) @@ -1150,8 +1150,7 @@ static PyObject *OSAObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject OSAComponentInstance_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_OSA.OSAComponentInstance", /*tp_name*/ sizeof(OSAComponentInstanceObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1222,7 +1221,7 @@ void init_OSA(void) if (OSA_Error == NULL || PyDict_SetItemString(d, "Error", OSA_Error) != 0) return; - OSAComponentInstance_Type.ob_type = &PyType_Type; + Py_Type(&OSAComponentInstance_Type) = &PyType_Type; if (PyType_Ready(&OSAComponentInstance_Type) < 0) return; Py_INCREF(&OSAComponentInstance_Type); PyModule_AddObject(m, "OSAComponentInstance", (PyObject *)&OSAComponentInstance_Type); diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index bfb040fe1c1..1e4c7005114 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -73,7 +73,7 @@ static PyObject *Qd_Error; PyTypeObject GrafPort_Type; -#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type)) +#define GrafObj_Check(x) (Py_Type(x) == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type)) typedef struct GrafPortObject { PyObject_HEAD @@ -125,7 +125,7 @@ int GrafObj_Convert(PyObject *v, GrafPtr *p_itself) static void GrafObj_dealloc(GrafPortObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args) @@ -1358,8 +1358,7 @@ static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_ PyTypeObject GrafPort_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qd.GrafPort", /*tp_name*/ sizeof(GrafPortObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1408,7 +1407,7 @@ PyTypeObject GrafPort_Type = { PyTypeObject BitMap_Type; -#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type)) +#define BMObj_Check(x) (Py_Type(x) == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type)) typedef struct BitMapObject { PyObject_HEAD @@ -1444,7 +1443,7 @@ static void BMObj_dealloc(BitMapObject *self) { Py_XDECREF(self->referred_object); if (self->referred_bitmap) free(self->referred_bitmap); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args) @@ -1557,8 +1556,7 @@ static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kw PyTypeObject BitMap_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qd.BitMap", /*tp_name*/ sizeof(BitMapObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -7124,14 +7122,14 @@ void init_Qd(void) if (Qd_Error == NULL || PyDict_SetItemString(d, "Error", Qd_Error) != 0) return; - GrafPort_Type.ob_type = &PyType_Type; + Py_Type(&GrafPort_Type) = &PyType_Type; if (PyType_Ready(&GrafPort_Type) < 0) return; Py_INCREF(&GrafPort_Type); PyModule_AddObject(m, "GrafPort", (PyObject *)&GrafPort_Type); /* Backward-compatible name */ Py_INCREF(&GrafPort_Type); PyModule_AddObject(m, "GrafPortType", (PyObject *)&GrafPort_Type); - BitMap_Type.ob_type = &PyType_Type; + Py_Type(&BitMap_Type) = &PyType_Type; if (PyType_Ready(&BitMap_Type) < 0) return; Py_INCREF(&BitMap_Type); PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type); diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c index 9a77054d120..6c9a003ef73 100644 --- a/Mac/Modules/qdoffs/_Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c @@ -34,7 +34,7 @@ static PyObject *Qdoffs_Error; PyTypeObject GWorld_Type; -#define GWorldObj_Check(x) ((x)->ob_type == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type)) +#define GWorldObj_Check(x) (Py_Type(x) == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type)) typedef struct GWorldObject { PyObject_HEAD @@ -65,7 +65,7 @@ int GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself) static void GWorldObj_dealloc(GWorldObject *self) { DisposeGWorld(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args) @@ -151,8 +151,7 @@ static PyObject *GWorldObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject PyTypeObject GWorld_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qdoffs.GWorld", /*tp_name*/ sizeof(GWorldObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -701,7 +700,7 @@ void init_Qdoffs(void) if (Qdoffs_Error == NULL || PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0) return; - GWorld_Type.ob_type = &PyType_Type; + Py_Type(&GWorld_Type) = &PyType_Type; if (PyType_Ready(&GWorld_Type) < 0) return; Py_INCREF(&GWorld_Type); PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type); diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c index 65cec4b39c5..d105b3233e7 100644 --- a/Mac/Modules/qt/_Qtmodule.c +++ b/Mac/Modules/qt/_Qtmodule.c @@ -97,7 +97,7 @@ static PyObject *Qt_Error; PyTypeObject IdleManager_Type; -#define IdleManagerObj_Check(x) ((x)->ob_type == &IdleManager_Type || PyObject_TypeCheck((x), &IdleManager_Type)) +#define IdleManagerObj_Check(x) (Py_Type(x) == &IdleManager_Type || PyObject_TypeCheck((x), &IdleManager_Type)) typedef struct IdleManagerObject { PyObject_HEAD @@ -136,7 +136,7 @@ int IdleManagerObj_Convert(PyObject *v, IdleManager *p_itself) static void IdleManagerObj_dealloc(IdleManagerObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyMethodDef IdleManagerObj_methods[] = { @@ -171,8 +171,7 @@ static PyObject *IdleManagerObj_tp_new(PyTypeObject *type, PyObject *_args, PyOb PyTypeObject IdleManager_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.IdleManager", /*tp_name*/ sizeof(IdleManagerObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -221,7 +220,7 @@ PyTypeObject IdleManager_Type = { PyTypeObject MovieController_Type; -#define MovieCtlObj_Check(x) ((x)->ob_type == &MovieController_Type || PyObject_TypeCheck((x), &MovieController_Type)) +#define MovieCtlObj_Check(x) (Py_Type(x) == &MovieController_Type || PyObject_TypeCheck((x), &MovieController_Type)) typedef struct MovieControllerObject { PyObject_HEAD @@ -260,7 +259,7 @@ int MovieCtlObj_Convert(PyObject *v, MovieController *p_itself) static void MovieCtlObj_dealloc(MovieControllerObject *self) { if (self->ob_itself) DisposeMovieController(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *MovieCtlObj_MCSetMovie(MovieControllerObject *_self, PyObject *_args) @@ -1291,8 +1290,7 @@ static PyObject *MovieCtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject MovieController_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.MovieController", /*tp_name*/ sizeof(MovieControllerObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1341,7 +1339,7 @@ PyTypeObject MovieController_Type = { PyTypeObject TimeBase_Type; -#define TimeBaseObj_Check(x) ((x)->ob_type == &TimeBase_Type || PyObject_TypeCheck((x), &TimeBase_Type)) +#define TimeBaseObj_Check(x) (Py_Type(x) == &TimeBase_Type || PyObject_TypeCheck((x), &TimeBase_Type)) typedef struct TimeBaseObject { PyObject_HEAD @@ -1380,7 +1378,7 @@ int TimeBaseObj_Convert(PyObject *v, TimeBase *p_itself) static void TimeBaseObj_dealloc(TimeBaseObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *TimeBaseObj_DisposeTimeBase(TimeBaseObject *_self, PyObject *_args) @@ -1785,8 +1783,7 @@ static PyObject *TimeBaseObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject TimeBase_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.TimeBase", /*tp_name*/ sizeof(TimeBaseObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1835,7 +1832,7 @@ PyTypeObject TimeBase_Type = { PyTypeObject UserData_Type; -#define UserDataObj_Check(x) ((x)->ob_type == &UserData_Type || PyObject_TypeCheck((x), &UserData_Type)) +#define UserDataObj_Check(x) (Py_Type(x) == &UserData_Type || PyObject_TypeCheck((x), &UserData_Type)) typedef struct UserDataObject { PyObject_HEAD @@ -1874,7 +1871,7 @@ int UserDataObj_Convert(PyObject *v, UserData *p_itself) static void UserDataObj_dealloc(UserDataObject *self) { if (self->ob_itself) DisposeUserData(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *UserDataObj_GetUserData(UserDataObject *_self, PyObject *_args) @@ -2156,8 +2153,7 @@ static PyObject *UserDataObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject UserData_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.UserData", /*tp_name*/ sizeof(UserDataObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -2206,7 +2202,7 @@ PyTypeObject UserData_Type = { PyTypeObject Media_Type; -#define MediaObj_Check(x) ((x)->ob_type == &Media_Type || PyObject_TypeCheck((x), &Media_Type)) +#define MediaObj_Check(x) (Py_Type(x) == &Media_Type || PyObject_TypeCheck((x), &Media_Type)) typedef struct MediaObject { PyObject_HEAD @@ -2245,7 +2241,7 @@ int MediaObj_Convert(PyObject *v, Media *p_itself) static void MediaObj_dealloc(MediaObject *self) { if (self->ob_itself) DisposeTrackMedia(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *MediaObj_LoadMediaIntoRam(MediaObject *_self, PyObject *_args) @@ -3398,8 +3394,7 @@ static PyObject *MediaObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject * PyTypeObject Media_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.Media", /*tp_name*/ sizeof(MediaObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -3448,7 +3443,7 @@ PyTypeObject Media_Type = { PyTypeObject Track_Type; -#define TrackObj_Check(x) ((x)->ob_type == &Track_Type || PyObject_TypeCheck((x), &Track_Type)) +#define TrackObj_Check(x) (Py_Type(x) == &Track_Type || PyObject_TypeCheck((x), &Track_Type)) typedef struct TrackObject { PyObject_HEAD @@ -3487,7 +3482,7 @@ int TrackObj_Convert(PyObject *v, Track *p_itself) static void TrackObj_dealloc(TrackObject *self) { if (self->ob_itself) DisposeMovieTrack(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *TrackObj_LoadTrackIntoRam(TrackObject *_self, PyObject *_args) @@ -4746,8 +4741,7 @@ static PyObject *TrackObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject * PyTypeObject Track_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.Track", /*tp_name*/ sizeof(TrackObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -4796,7 +4790,7 @@ PyTypeObject Track_Type = { PyTypeObject Movie_Type; -#define MovieObj_Check(x) ((x)->ob_type == &Movie_Type || PyObject_TypeCheck((x), &Movie_Type)) +#define MovieObj_Check(x) (Py_Type(x) == &Movie_Type || PyObject_TypeCheck((x), &Movie_Type)) typedef struct MovieObject { PyObject_HEAD @@ -4835,7 +4829,7 @@ int MovieObj_Convert(PyObject *v, Movie *p_itself) static void MovieObj_dealloc(MovieObject *self) { if (self->ob_itself) DisposeMovie(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *MovieObj_MoviesTask(MovieObject *_self, PyObject *_args) @@ -7299,8 +7293,7 @@ static PyObject *MovieObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject * PyTypeObject Movie_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.Movie", /*tp_name*/ sizeof(MovieObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -7349,7 +7342,7 @@ PyTypeObject Movie_Type = { PyTypeObject SGOutput_Type; -#define SGOutputObj_Check(x) ((x)->ob_type == &SGOutput_Type || PyObject_TypeCheck((x), &SGOutput_Type)) +#define SGOutputObj_Check(x) (Py_Type(x) == &SGOutput_Type || PyObject_TypeCheck((x), &SGOutput_Type)) typedef struct SGOutputObject { PyObject_HEAD @@ -7388,7 +7381,7 @@ int SGOutputObj_Convert(PyObject *v, SGOutput *p_itself) static void SGOutputObj_dealloc(SGOutputObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyMethodDef SGOutputObj_methods[] = { @@ -7423,8 +7416,7 @@ static PyObject *SGOutputObj_tp_new(PyTypeObject *type, PyObject *_args, PyObjec PyTypeObject SGOutput_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Qt.SGOutput", /*tp_name*/ sizeof(SGOutputObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -28021,56 +28013,56 @@ void init_Qt(void) if (Qt_Error == NULL || PyDict_SetItemString(d, "Error", Qt_Error) != 0) return; - IdleManager_Type.ob_type = &PyType_Type; + Py_Type(&IdleManager_Type) = &PyType_Type; if (PyType_Ready(&IdleManager_Type) < 0) return; Py_INCREF(&IdleManager_Type); PyModule_AddObject(m, "IdleManager", (PyObject *)&IdleManager_Type); /* Backward-compatible name */ Py_INCREF(&IdleManager_Type); PyModule_AddObject(m, "IdleManagerType", (PyObject *)&IdleManager_Type); - MovieController_Type.ob_type = &PyType_Type; + Py_Type(&MovieController_Type) = &PyType_Type; if (PyType_Ready(&MovieController_Type) < 0) return; Py_INCREF(&MovieController_Type); PyModule_AddObject(m, "MovieController", (PyObject *)&MovieController_Type); /* Backward-compatible name */ Py_INCREF(&MovieController_Type); PyModule_AddObject(m, "MovieControllerType", (PyObject *)&MovieController_Type); - TimeBase_Type.ob_type = &PyType_Type; + Py_Type(&TimeBase_Type) = &PyType_Type; if (PyType_Ready(&TimeBase_Type) < 0) return; Py_INCREF(&TimeBase_Type); PyModule_AddObject(m, "TimeBase", (PyObject *)&TimeBase_Type); /* Backward-compatible name */ Py_INCREF(&TimeBase_Type); PyModule_AddObject(m, "TimeBaseType", (PyObject *)&TimeBase_Type); - UserData_Type.ob_type = &PyType_Type; + Py_Type(&UserData_Type) = &PyType_Type; if (PyType_Ready(&UserData_Type) < 0) return; Py_INCREF(&UserData_Type); PyModule_AddObject(m, "UserData", (PyObject *)&UserData_Type); /* Backward-compatible name */ Py_INCREF(&UserData_Type); PyModule_AddObject(m, "UserDataType", (PyObject *)&UserData_Type); - Media_Type.ob_type = &PyType_Type; + Py_Type(&Media_Type) = &PyType_Type; if (PyType_Ready(&Media_Type) < 0) return; Py_INCREF(&Media_Type); PyModule_AddObject(m, "Media", (PyObject *)&Media_Type); /* Backward-compatible name */ Py_INCREF(&Media_Type); PyModule_AddObject(m, "MediaType", (PyObject *)&Media_Type); - Track_Type.ob_type = &PyType_Type; + Py_Type(&Track_Type) = &PyType_Type; if (PyType_Ready(&Track_Type) < 0) return; Py_INCREF(&Track_Type); PyModule_AddObject(m, "Track", (PyObject *)&Track_Type); /* Backward-compatible name */ Py_INCREF(&Track_Type); PyModule_AddObject(m, "TrackType", (PyObject *)&Track_Type); - Movie_Type.ob_type = &PyType_Type; + Py_Type(&Movie_Type) = &PyType_Type; if (PyType_Ready(&Movie_Type) < 0) return; Py_INCREF(&Movie_Type); PyModule_AddObject(m, "Movie", (PyObject *)&Movie_Type); /* Backward-compatible name */ Py_INCREF(&Movie_Type); PyModule_AddObject(m, "MovieType", (PyObject *)&Movie_Type); - SGOutput_Type.ob_type = &PyType_Type; + Py_Type(&SGOutput_Type) = &PyType_Type; if (PyType_Ready(&SGOutput_Type) < 0) return; Py_INCREF(&SGOutput_Type); PyModule_AddObject(m, "SGOutput", (PyObject *)&SGOutput_Type); diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index 9069e9c7fcf..1cc38ef64c1 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -41,7 +41,7 @@ static PyObject *Res_Error; PyTypeObject Resource_Type; -#define ResObj_Check(x) ((x)->ob_type == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type)) +#define ResObj_Check(x) (Py_Type(x) == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type)) typedef struct ResourceObject { PyObject_HEAD @@ -89,7 +89,7 @@ static void ResObj_dealloc(ResourceObject *self) self->ob_freeit(self->ob_itself); } self->ob_itself = NULL; - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args) @@ -617,8 +617,7 @@ static PyObject *ResObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject Resource_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Res.Resource", /*tp_name*/ sizeof(ResourceObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1731,7 +1730,7 @@ void init_Res(void) if (Res_Error == NULL || PyDict_SetItemString(d, "Error", Res_Error) != 0) return; - Resource_Type.ob_type = &PyType_Type; + Py_Type(&Resource_Type) = &PyType_Type; if (PyType_Ready(&Resource_Type) < 0) return; Py_INCREF(&Resource_Type); PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type); diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c index 5ee22eba340..ade5e579c27 100644 --- a/Mac/Modules/scrap/_Scrapmodule.c +++ b/Mac/Modules/scrap/_Scrapmodule.c @@ -23,7 +23,7 @@ static PyObject *Scrap_Error; PyTypeObject Scrap_Type; -#define ScrapObj_Check(x) ((x)->ob_type == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type)) +#define ScrapObj_Check(x) (Py_Type(x) == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type)) typedef struct ScrapObject { PyObject_HEAD @@ -52,7 +52,7 @@ int ScrapObj_Convert(PyObject *v, ScrapRef *p_itself) static void ScrapObj_dealloc(ScrapObject *self) { /* Cleanup of self->ob_itself goes here */ - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *ScrapObj_GetScrapFlavorFlags(ScrapObject *_self, PyObject *_args) @@ -230,8 +230,7 @@ static PyObject *ScrapObj_getattr(ScrapObject *self, char *name) #define ScrapObj_hash NULL PyTypeObject Scrap_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Scrap.Scrap", /*tp_name*/ sizeof(ScrapObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -347,7 +346,7 @@ void init_Scrap(void) if (Scrap_Error == NULL || PyDict_SetItemString(d, "Error", Scrap_Error) != 0) return; - Scrap_Type.ob_type = &PyType_Type; + Py_Type(&Scrap_Type) = &PyType_Type; Py_INCREF(&Scrap_Type); if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0) Py_FatalError("can't initialize ScrapType"); diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index fcaee5f1f4c..867c8f7d087 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -42,7 +42,7 @@ static PyObject *Snd_Error; static PyTypeObject SndChannel_Type; -#define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type || PyObject_TypeCheck((x), &SndChannel_Type)) +#define SndCh_Check(x) (Py_Type(x) == &SndChannel_Type || PyObject_TypeCheck((x), &SndChannel_Type)) typedef struct SndChannelObject { PyObject_HEAD @@ -207,8 +207,7 @@ static PyMethodDef SndCh_methods[] = { #define SndCh_hash NULL static PyTypeObject SndChannel_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Snd.SndChannel", /*tp_name*/ sizeof(SndChannelObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -257,7 +256,7 @@ static PyTypeObject SndChannel_Type = { static PyTypeObject SPB_Type; -#define SPBObj_Check(x) ((x)->ob_type == &SPB_Type || PyObject_TypeCheck((x), &SPB_Type)) +#define SPBObj_Check(x) (Py_Type(x) == &SPB_Type || PyObject_TypeCheck((x), &SPB_Type)) typedef struct SPBObject { PyObject_HEAD @@ -375,8 +374,7 @@ static PyGetSetDef SPBObj_getsetlist[] = { #define SPBObj_hash NULL static PyTypeObject SPB_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Snd.SPB", /*tp_name*/ sizeof(SPBObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1131,14 +1129,14 @@ void init_Snd(void) if (Snd_Error == NULL || PyDict_SetItemString(d, "Error", Snd_Error) != 0) return; - SndChannel_Type.ob_type = &PyType_Type; + Py_Type(&SndChannel_Type) = &PyType_Type; if (PyType_Ready(&SndChannel_Type) < 0) return; Py_INCREF(&SndChannel_Type); PyModule_AddObject(m, "SndChannel", (PyObject *)&SndChannel_Type); /* Backward-compatible name */ Py_INCREF(&SndChannel_Type); PyModule_AddObject(m, "SndChannelType", (PyObject *)&SndChannel_Type); - SPB_Type.ob_type = &PyType_Type; + Py_Type(&SPB_Type) = &PyType_Type; if (PyType_Ready(&SPB_Type) < 0) return; Py_INCREF(&SPB_Type); PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type); diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c index 047b8721046..893758c1c48 100644 --- a/Mac/Modules/te/_TEmodule.c +++ b/Mac/Modules/te/_TEmodule.c @@ -58,7 +58,7 @@ static PyObject *TE_Error; PyTypeObject TE_Type; -#define TEObj_Check(x) ((x)->ob_type == &TE_Type || PyObject_TypeCheck((x), &TE_Type)) +#define TEObj_Check(x) (Py_Type(x) == &TE_Type || PyObject_TypeCheck((x), &TE_Type)) typedef struct TEObject { PyObject_HEAD @@ -92,7 +92,7 @@ int TEObj_Convert(PyObject *v, TEHandle *p_itself) static void TEObj_dealloc(TEObject *self) { TEDispose(self->ob_itself); - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args) @@ -1000,8 +1000,7 @@ static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kw PyTypeObject TE_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_TE.TE", /*tp_name*/ sizeof(TEObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1318,7 +1317,7 @@ void init_TE(void) if (TE_Error == NULL || PyDict_SetItemString(d, "Error", TE_Error) != 0) return; - TE_Type.ob_type = &PyType_Type; + Py_Type(&TE_Type) = &PyType_Type; if (PyType_Ready(&TE_Type) < 0) return; Py_INCREF(&TE_Type); PyModule_AddObject(m, "TE", (PyObject *)&TE_Type); diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c index 3841775e90e..ae864689499 100644 --- a/Mac/Modules/win/_Winmodule.c +++ b/Mac/Modules/win/_Winmodule.c @@ -45,7 +45,7 @@ static PyObject *Win_Error; PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type || PyObject_TypeCheck((x), &Window_Type)) +#define WinObj_Check(x) (Py_Type(x) == &Window_Type || PyObject_TypeCheck((x), &Window_Type)) typedef struct WindowObject { PyObject_HEAD @@ -102,7 +102,7 @@ static void WinObj_dealloc(WindowObject *self) } self->ob_itself = NULL; self->ob_freeit = NULL; - self->ob_type->tp_free((PyObject *)self); + Py_Type(self)->tp_free((PyObject *)self); } static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args) @@ -2607,8 +2607,7 @@ static PyObject *WinObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_k PyTypeObject Window_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_Win.Window", /*tp_name*/ sizeof(WindowObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -3245,7 +3244,7 @@ void init_Win(void) if (Win_Error == NULL || PyDict_SetItemString(d, "Error", Win_Error) != 0) return; - Window_Type.ob_type = &PyType_Type; + Py_Type(&Window_Type) = &PyType_Type; if (PyType_Ready(&Window_Type) < 0) return; Py_INCREF(&Window_Type); PyModule_AddObject(m, "Window", (PyObject *)&Window_Type); diff --git a/PC/_subprocess.c b/PC/_subprocess.c index f048bc21cc1..14e133326e0 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -128,8 +128,7 @@ sp_handle_as_int(sp_handle_object* self) static PyNumberMethods sp_handle_as_number; static PyTypeObject sp_handle_type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_subprocess_handle", sizeof(sp_handle_object), 0, (destructor) sp_handle_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -273,7 +272,7 @@ gethandle(PyObject* obj, char* name) PyErr_Clear(); /* FIXME: propagate error? */ return NULL; } - if (value->ob_type != &sp_handle_type) + if (Py_Type(&value) != &sp_handle_type) ret = NULL; else ret = value->handle; @@ -556,7 +555,7 @@ init_subprocess() PyObject *m; /* patch up object descriptors */ - sp_handle_type.ob_type = &PyType_Type; + Py_Type(&sp_handle_type) = &PyType_Type; sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int; m = Py_InitModule("_subprocess", sp_functions); diff --git a/PC/_winreg.c b/PC/_winreg.c index dcbdf084535..ecb723c09de 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -1450,7 +1450,7 @@ PyMODINIT_FUNC init_winreg(void) if (m == NULL) return; d = PyModule_GetDict(m); - PyHKEY_Type.ob_type = &PyType_Type; + Py_Type(&PyHKEY_Type) = &PyType_Type; PyHKEY_Type.tp_doc = PyHKEY_doc; Py_INCREF(&PyHKEY_Type); if (PyDict_SetItemString(d, "HKEYType",