diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index 8833a84ac46..b4984dafd16 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -338,7 +338,7 @@ navrr_getattr(navrrobject *self, char *name) PyObject *rv, *rvitem; AEDesc desc; - if (err=AECountItems(&self->itself.selection, &count)) { + if ((err=AECountItems(&self->itself.selection, &count))) { PyErr_Mac(ErrorObject, err); return NULL; } @@ -346,12 +346,12 @@ navrr_getattr(navrrobject *self, char *name) return NULL; for(i=0; iitself.selection, i+1, typeFSS, NULL, &desc)) { + if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &desc))) { Py_DECREF(rv); PyErr_Mac(ErrorObject, err); return NULL; } - if (err=AEGetDescData(&desc, &fss, sizeof(FSSpec))) { + if ((err=AEGetDescData(&desc, &fss, sizeof(FSSpec)))) { Py_DECREF(rv); PyErr_Mac(ErrorObject, err); return NULL; @@ -368,7 +368,7 @@ navrr_getattr(navrrobject *self, char *name) PyObject *rv, *rvitem; AEDesc desc; - if (err=AECountItems(&self->itself.selection, &count)) { + if ((err=AECountItems(&self->itself.selection, &count))) { PyErr_Mac(ErrorObject, err); return NULL; } @@ -376,12 +376,12 @@ navrr_getattr(navrrobject *self, char *name) return NULL; for(i=0; iitself.selection, i+1, typeFSRef, NULL, &desc)) { + if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc))) { Py_DECREF(rv); PyErr_Mac(ErrorObject, err); return NULL; } - if (err=AEGetDescData(&desc, &fsr, sizeof(FSRef))) { + if ((err=AEGetDescData(&desc, &fsr, sizeof(FSRef)))) { Py_DECREF(rv); PyErr_Mac(ErrorObject, err); return NULL; diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c index b5b4cd6d078..bcb24a75a67 100644 --- a/Mac/Modules/ae/_AEmodule.c +++ b/Mac/Modules/ae/_AEmodule.c @@ -94,7 +94,7 @@ int AEDesc_Convert(PyObject *v, AEDesc *p_itself) static void AEDesc_dealloc(AEDescObject *self) { AEDisposeDesc(&self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args) @@ -1434,6 +1434,7 @@ void init_AE(void) PyDict_SetItemString(d, "Error", AE_Error) != 0) return; AEDesc_Type.ob_type = &PyType_Type; + if (PyType_Ready(&AEDesc_Type) < 0) return; Py_INCREF(&AEDesc_Type); PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c index 347cf5bd670..069c08feb15 100644 --- a/Mac/Modules/app/_Appmodule.c +++ b/Mac/Modules/app/_Appmodule.c @@ -69,7 +69,7 @@ int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself) static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args) @@ -1818,6 +1818,7 @@ void init_App(void) PyDict_SetItemString(d, "Error", App_Error) != 0) return; ThemeDrawingState_Type.ob_type = &PyType_Type; + if (PyType_Ready(&ThemeDrawingState_Type) < 0) return; Py_INCREF(&ThemeDrawingState_Type); PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py index 7653b081819..492720f851a 100644 --- a/Mac/Modules/carbonevt/CarbonEvtsupport.py +++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py @@ -357,8 +357,8 @@ MPDeleteCriticalRegion(reentrantLock); #endif /* USE_MAC_MP_MULTITHREADING */ Py_INCREF(Py_None); - -return Py_None; +_res = Py_None; +return _res; """ f = ManualGenerator("RunApplicationEventLoop", runappeventloop); diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c index 86f67cf5f9c..6d1aa0f2efa 100755 --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c @@ -171,7 +171,7 @@ int EventRef_Convert(PyObject *v, EventRef *p_itself) static void EventRef_dealloc(EventRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventRef_RetainEvent(EventRefObject *_self, PyObject *_args) @@ -515,7 +515,7 @@ int EventQueueRef_Convert(PyObject *v, EventQueueRef *p_itself) static void EventQueueRef_dealloc(EventQueueRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventQueueRef_PostEventToQueue(EventQueueRefObject *_self, PyObject *_args) @@ -735,7 +735,7 @@ int EventLoopRef_Convert(PyObject *v, EventLoopRef *p_itself) static void EventLoopRef_dealloc(EventLoopRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventLoopRef_QuitEventLoop(EventLoopRefObject *_self, PyObject *_args) @@ -864,7 +864,7 @@ int EventLoopTimerRef_Convert(PyObject *v, EventLoopTimerRef *p_itself) static void EventLoopTimerRef_dealloc(EventLoopTimerRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventLoopTimerRef_RemoveEventLoopTimer(EventLoopTimerRefObject *_self, PyObject *_args) @@ -1016,7 +1016,7 @@ static void EventHandlerRef_dealloc(EventHandlerRefObject *self) RemoveEventHandler(self->ob_itself); Py_DECREF(self->ob_callback); } - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventHandlerRef_AddEventTypesToHandler(EventHandlerRefObject *_self, PyObject *_args) @@ -1203,7 +1203,7 @@ int EventHandlerCallRef_Convert(PyObject *v, EventHandlerCallRef *p_itself) static void EventHandlerCallRef_dealloc(EventHandlerCallRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventHandlerCallRef_CallNextEventHandler(EventHandlerCallRefObject *_self, PyObject *_args) @@ -1335,7 +1335,7 @@ int EventTargetRef_Convert(PyObject *v, EventTargetRef *p_itself) static void EventTargetRef_dealloc(EventTargetRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventTargetRef_InstallStandardEventHandler(EventTargetRefObject *_self, PyObject *_args) @@ -1489,7 +1489,7 @@ int EventHotKeyRef_Convert(PyObject *v, EventHotKeyRef *p_itself) static void EventHotKeyRef_dealloc(EventHotKeyRefObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *EventHotKeyRef_UnregisterEventHotKey(EventHotKeyRefObject *_self, PyObject *_args) @@ -2067,8 +2067,8 @@ static PyObject *CarbonEvents_RunApplicationEventLoop(PyObject *_self, PyObject #endif /* USE_MAC_MP_MULTITHREADING */ Py_INCREF(Py_None); - - return Py_None; + _res = Py_None; + return _res; } @@ -2157,48 +2157,56 @@ void init_CarbonEvt(void) PyDict_SetItemString(d, "Error", CarbonEvents_Error) != 0) return; EventRef_Type.ob_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; + 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; + 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; + 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; + 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; + 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; + 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; + if (PyType_Ready(&EventHotKeyRef_Type) < 0) return; Py_INCREF(&EventHotKeyRef_Type); PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c index fbafc6c1ce8..3bc114c82b1 100755 --- a/Mac/Modules/cg/_CGmodule.c +++ b/Mac/Modules/cg/_CGmodule.c @@ -241,7 +241,7 @@ int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself) static void CGContextRefObj_dealloc(CGContextRefObject *self) { CGContextRelease(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args) @@ -1399,6 +1399,7 @@ void init_CG(void) PyDict_SetItemString(d, "Error", CG_Error) != 0) return; CGContextRef_Type.ob_type = &PyType_Type; + if (PyType_Ready(&CGContextRef_Type) < 0) return; Py_INCREF(&CGContextRef_Type); PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c index 1eaa577a8c9..7abdaa966e2 100644 --- a/Mac/Modules/cm/_Cmmodule.c +++ b/Mac/Modules/cm/_Cmmodule.c @@ -102,7 +102,7 @@ int CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself) static void CmpInstObj_dealloc(ComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args) @@ -373,7 +373,7 @@ int CmpObj_Convert(PyObject *v, Component *p_itself) static void CmpObj_dealloc(ComponentObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args) @@ -935,12 +935,14 @@ void init_Cm(void) PyDict_SetItemString(d, "Error", Cm_Error) != 0) return; ComponentInstance_Type.ob_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; + if (PyType_Ready(&Component_Type) < 0) return; Py_INCREF(&Component_Type); PyModule_AddObject(m, "Component", (PyObject *)&Component_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index cc4bce2d75a..98c6f4f05be 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -179,7 +179,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 */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args) @@ -5849,6 +5849,7 @@ void init_Ctl(void) PyDict_SetItemString(d, "Error", Ctl_Error) != 0) return; Control_Type.ob_type = &PyType_Type; + if (PyType_Ready(&Control_Type) < 0) return; Py_INCREF(&Control_Type); PyModule_AddObject(m, "Control", (PyObject *)&Control_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c index 50edc872030..c4e3ed88195 100644 --- a/Mac/Modules/dlg/_Dlgmodule.c +++ b/Mac/Modules/dlg/_Dlgmodule.c @@ -172,7 +172,7 @@ int DlgObj_Convert(PyObject *v, DialogPtr *p_itself) static void DlgObj_dealloc(DialogObject *self) { DisposeDialog(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args) @@ -1590,6 +1590,7 @@ void init_Dlg(void) PyDict_SetItemString(d, "Error", Dlg_Error) != 0) return; Dialog_Type.ob_type = &PyType_Type; + if (PyType_Ready(&Dialog_Type) < 0) return; Py_INCREF(&Dialog_Type); PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c index 1a9406fbf66..3b00da81376 100644 --- a/Mac/Modules/drag/_Dragmodule.c +++ b/Mac/Modules/drag/_Dragmodule.c @@ -84,7 +84,7 @@ int DragObj_Convert(PyObject *v, DragRef *p_itself) static void DragObj_dealloc(DragObjObject *self) { Py_XDECREF(self->sendproc); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args) @@ -1135,6 +1135,7 @@ void init_Drag(void) PyDict_SetItemString(d, "Error", Drag_Error) != 0) return; DragObj_Type.ob_type = &PyType_Type; + if (PyType_Ready(&DragObj_Type) < 0) return; Py_INCREF(&DragObj_Type); PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index ad901455d99..70a8720abca 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -2740,24 +2740,28 @@ void init_File(void) PyDict_SetItemString(d, "Error", File_Error) != 0) return; FInfo_Type.ob_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; + 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; + 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; + if (PyType_Ready(&FSRef_Type) < 0) return; Py_INCREF(&FSRef_Type); PyModule_AddObject(m, "FSRef", (PyObject *)&FSRef_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c index d2eff0276d8..1a712c690a4 100644 --- a/Mac/Modules/ibcarbon/_IBCarbon.c +++ b/Mac/Modules/ibcarbon/_IBCarbon.c @@ -55,7 +55,7 @@ int IBNibRefObj_Convert(PyObject *v, IBNibRef *p_itself) static void IBNibRefObj_dealloc(IBNibRefObject *self) { DisposeNibReference(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *IBNibRefObj_CreateWindowFromNib(IBNibRefObject *_self, PyObject *_args) @@ -256,6 +256,7 @@ void init_IBCarbon(void) PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0) return; IBNibRef_Type.ob_type = &PyType_Type; + if (PyType_Ready(&IBNibRef_Type) < 0) return; Py_INCREF(&IBNibRef_Type); PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c index 5cd007e9f15..05af28e2b90 100644 --- a/Mac/Modules/list/_Listmodule.c +++ b/Mac/Modules/list/_Listmodule.c @@ -112,7 +112,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); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args) @@ -1151,6 +1151,7 @@ void init_List(void) PyDict_SetItemString(d, "Error", List_Error) != 0) return; List_Type.ob_type = &PyType_Type; + if (PyType_Ready(&List_Type) < 0) return; Py_INCREF(&List_Type); PyModule_AddObject(m, "List", (PyObject *)&List_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index 2ff58958537..5b445c0f853 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -566,7 +566,7 @@ MacOS_openrf(PyObject *self, PyObject *args) FILE *tfp; char pathname[PATHNAMELEN]; - if ( err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN) ) { + if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) { PyMac_Error(err); Py_DECREF(fp); return NULL; diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c index 629adaf5c24..4e3aa20d87c 100644 --- a/Mac/Modules/menu/_Menumodule.c +++ b/Mac/Modules/menu/_Menumodule.c @@ -64,8 +64,6 @@ PyObject *OptMenuObj_New(MenuRef itself) /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */ int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) { - PyObject *tmp; - if ( v == Py_None ) { *p_itself = NULL; return 1; @@ -108,7 +106,7 @@ int MenuObj_Convert(PyObject *v, MenuHandle *p_itself) static void MenuObj_dealloc(MenuObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args) @@ -3478,6 +3476,7 @@ void init_Menu(void) PyDict_SetItemString(d, "Error", Menu_Error) != 0) return; Menu_Type.ob_type = &PyType_Type; + if (PyType_Ready(&Menu_Type) < 0) return; Py_INCREF(&Menu_Type); PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py index 7a660c57eff..6c8229cc720 100644 --- a/Mac/Modules/menu/menusupport.py +++ b/Mac/Modules/menu/menusupport.py @@ -83,8 +83,6 @@ PyObject *OptMenuObj_New(MenuRef itself) /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */ int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) { - PyObject *tmp; - if ( v == Py_None ) { *p_itself = NULL; return 1; diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c index dd30b97ef01..aebec02b5ef 100644 --- a/Mac/Modules/mlte/_Mltemodule.c +++ b/Mac/Modules/mlte/_Mltemodule.c @@ -125,7 +125,7 @@ int TXNObj_Convert(PyObject *v, TXNObject *p_itself) static void TXNObj_dealloc(TXNObjectObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args) @@ -1377,7 +1377,7 @@ int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself) static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args) @@ -1703,12 +1703,14 @@ void init_Mlte(void) PyDict_SetItemString(d, "Error", Mlte_Error) != 0) return; TXNObject_Type.ob_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; + if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return; Py_INCREF(&TXNFontMenuObject_Type); PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index c1690c180f5..8187baa4b08 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -196,7 +196,7 @@ int GrafObj_Convert(PyObject *v, GrafPtr *p_itself) static void GrafObj_dealloc(GrafPortObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args) @@ -1172,7 +1172,7 @@ static void BMObj_dealloc(BitMapObject *self) { Py_XDECREF(self->referred_object); if (self->referred_bitmap) free(self->referred_bitmap); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args) @@ -6851,12 +6851,14 @@ void init_Qd(void) PyDict_SetItemString(d, "Error", Qd_Error) != 0) return; GrafPort_Type.ob_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; + if (PyType_Ready(&BitMap_Type) < 0) return; Py_INCREF(&BitMap_Type); PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c index ea3d0155dbe..8d9f7efd0d0 100644 --- a/Mac/Modules/qdoffs/_Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c @@ -73,7 +73,7 @@ int GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself) static void GWorldObj_dealloc(GWorldObject *self) { DisposeGWorld(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args) @@ -710,6 +710,7 @@ void init_Qdoffs(void) PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0) return; GWorld_Type.ob_type = &PyType_Type; + if (PyType_Ready(&GWorld_Type) < 0) return; Py_INCREF(&GWorld_Type); PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c index 83c6bac12df..6da1a5354c2 100644 --- a/Mac/Modules/qt/_Qtmodule.c +++ b/Mac/Modules/qt/_Qtmodule.c @@ -130,7 +130,7 @@ int MovieCtlObj_Convert(PyObject *v, MovieController *p_itself) static void MovieCtlObj_dealloc(MovieControllerObject *self) { DisposeMovieController(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *MovieCtlObj_MCSetMovie(MovieControllerObject *_self, PyObject *_args) @@ -1201,7 +1201,7 @@ int TimeBaseObj_Convert(PyObject *v, TimeBase *p_itself) static void TimeBaseObj_dealloc(TimeBaseObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *TimeBaseObj_DisposeTimeBase(TimeBaseObject *_self, PyObject *_args) @@ -1689,7 +1689,7 @@ int UserDataObj_Convert(PyObject *v, UserData *p_itself) static void UserDataObj_dealloc(UserDataObject *self) { DisposeUserData(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *UserDataObj_GetUserData(UserDataObject *_self, PyObject *_args) @@ -2030,7 +2030,7 @@ int MediaObj_Convert(PyObject *v, Media *p_itself) static void MediaObj_dealloc(MediaObject *self) { DisposeTrackMedia(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *MediaObj_LoadMediaIntoRam(MediaObject *_self, PyObject *_args) @@ -3242,7 +3242,7 @@ int TrackObj_Convert(PyObject *v, Track *p_itself) static void TrackObj_dealloc(TrackObject *self) { DisposeMovieTrack(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *TrackObj_LoadTrackIntoRam(TrackObject *_self, PyObject *_args) @@ -4560,7 +4560,7 @@ int MovieObj_Convert(PyObject *v, Movie *p_itself) static void MovieObj_dealloc(MovieObject *self) { DisposeMovie(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *MovieObj_MoviesTask(MovieObject *_self, PyObject *_args) @@ -9740,36 +9740,42 @@ void init_Qt(void) PyDict_SetItemString(d, "Error", Qt_Error) != 0) return; MovieController_Type.ob_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; + 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; + 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; + 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; + 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; + if (PyType_Ready(&Movie_Type) < 0) return; Py_INCREF(&Movie_Type); PyModule_AddObject(m, "Movie", (PyObject *)&Movie_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index e34c2c59a3f..e759269db0d 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -101,7 +101,7 @@ static void ResObj_dealloc(ResourceObject *self) self->ob_freeit(self->ob_itself); } self->ob_itself = NULL; - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args) @@ -1744,6 +1744,7 @@ void init_Res(void) PyDict_SetItemString(d, "Error", Res_Error) != 0) return; Resource_Type.ob_type = &PyType_Type; + if (PyType_Ready(&Resource_Type) < 0) return; Py_INCREF(&Resource_Type); PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c index 9c681d3c5b3..58e565f8d80 100644 --- a/Mac/Modules/scrap/_Scrapmodule.c +++ b/Mac/Modules/scrap/_Scrapmodule.c @@ -127,7 +127,6 @@ static PyObject *ScrapObj_GetScrapFlavorData(ScrapObject *_self, PyObject *_args Py_XDECREF(_res); return PyMac_Error(_err); } - destination__error__: ; return _res; } @@ -152,7 +151,6 @@ static PyObject *ScrapObj_PutScrapFlavor(ScrapObject *_self, PyObject *_args) if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; - flavorData__error__: ; return _res; } diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index 136504bfea4..c27fab626dd 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -78,7 +78,7 @@ static void SndCh_dealloc(SndChannelObject *self) { SndDisposeChannel(self->ob_itself, 1); Py_XDECREF(self->ob_callback); - PyObject_Del(self); + PyObject_Free((PyObject *)self); } static PyObject *SndCh_SndDoCommand(SndChannelObject *_self, PyObject *_args) @@ -310,7 +310,7 @@ static void SPBObj_dealloc(SPBObject *self) self->ob_thiscallback = 0; Py_XDECREF(self->ob_completion); Py_XDECREF(self->ob_interrupt); - PyObject_Del(self); + PyObject_Free((PyObject *)self); } static PyMethodDef SPBObj_methods[] = { @@ -1142,12 +1142,14 @@ void init_Snd(void) PyDict_SetItemString(d, "Error", Snd_Error) != 0) return; SndChannel_Type.ob_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; + if (PyType_Ready(&SPB_Type) < 0) return; Py_INCREF(&SPB_Type); PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c index ec5b9cb732c..2da25135076 100644 --- a/Mac/Modules/te/_TEmodule.c +++ b/Mac/Modules/te/_TEmodule.c @@ -100,7 +100,7 @@ int TEObj_Convert(PyObject *v, TEHandle *p_itself) static void TEObj_dealloc(TEObject *self) { TEDispose(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args) @@ -1327,6 +1327,7 @@ void init_TE(void) PyDict_SetItemString(d, "Error", TE_Error) != 0) return; TE_Type.ob_type = &PyType_Type; + if (PyType_Ready(&TE_Type) < 0) return; Py_INCREF(&TE_Type); PyModule_AddObject(m, "TE", (PyObject *)&TE_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index 85159e5c487..f05e467b0b1 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -42,15 +42,15 @@ static PyObject *ExistingwasteObj_New(WEReference); /* ** Parse/generate TextStyle records */ -static -PyObject *TextStyle_New(TextStylePtr itself) +static PyObject * +TextStyle_New(TextStylePtr itself) { return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, &itself->tsColor); } -static +static int TextStyle_Convert(PyObject *v, TextStylePtr p_itself) { long font, face, size; @@ -66,8 +66,8 @@ TextStyle_Convert(PyObject *v, TextStylePtr p_itself) /* ** Parse/generate RunInfo records */ -static -PyObject *RunInfo_New(WERunInfo *itself) +static PyObject * +RunInfo_New(WERunInfo *itself) { return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight, @@ -87,7 +87,7 @@ LongRect_New(LongRect *r) return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom); } - +int LongPt_Convert(PyObject *v, LongPt *p) { return PyArg_Parse(v, "(ll)", &p->h, &p->v); @@ -146,8 +146,12 @@ my_new_handler(Point *objectSize, WEObjectReference objref) if (!PyMac_GetPoint(rv, objectSize) ) err = errAECoercionFail; } - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -159,8 +163,12 @@ my_dispose_handler(WEObjectReference objref) args=Py_BuildValue("(O&)", WEOObj_New, objref); err = any_handler(weDisposeHandler, objref, args, &rv); - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -172,8 +180,12 @@ my_draw_handler(const Rect *destRect, WEObjectReference objref) args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref); err = any_handler(weDrawHandler, objref, args, &rv); - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -192,8 +204,12 @@ my_click_handler(Point hitPt, EventModifiers modifiers, retvalue = PyInt_AsLong(rv); else retvalue = 0; - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return retvalue; } @@ -238,7 +254,7 @@ int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself) static void WEOObj_dealloc(WEOObject *self) { /* Cleanup of self->ob_itself goes here */ - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args) @@ -492,7 +508,7 @@ int wasteObj_Convert(PyObject *v, WEReference *p_itself) static void wasteObj_dealloc(wasteObject *self) { WEDispose(self->ob_itself); - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args) @@ -2441,7 +2457,8 @@ static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args) (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr) goto cleanup; Py_INCREF(Py_None); - return Py_None; + _res = Py_None; + return _res; cleanup: return PyMac_Error(err); @@ -2483,7 +2500,8 @@ static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args) err = WEInstallObjectHandler(objectType, selector, handler, we); if ( err ) return PyMac_Error(err); Py_INCREF(Py_None); - return Py_None; + _res = Py_None; + return _res; } @@ -2555,12 +2573,14 @@ void initwaste(void) PyDict_SetItemString(d, "Error", waste_Error) != 0) return; WEO_Type.ob_type = &PyType_Type; + if (PyType_Ready(&WEO_Type) < 0) return; Py_INCREF(&WEO_Type); PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type); /* Backward-compatible name */ Py_INCREF(&WEO_Type); PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type); waste_Type.ob_type = &PyType_Type; + if (PyType_Ready(&waste_Type) < 0) return; Py_INCREF(&waste_Type); PyModule_AddObject(m, "waste", (PyObject *)&waste_Type); /* Backward-compatible name */ diff --git a/Mac/Modules/waste/wastesupport.py b/Mac/Modules/waste/wastesupport.py index 2e165a93d27..e983b154ce6 100644 --- a/Mac/Modules/waste/wastesupport.py +++ b/Mac/Modules/waste/wastesupport.py @@ -82,15 +82,15 @@ static PyObject *ExistingwasteObj_New(WEReference); /* ** Parse/generate TextStyle records */ -static -PyObject *TextStyle_New(TextStylePtr itself) +static PyObject * +TextStyle_New(TextStylePtr itself) { return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, &itself->tsColor); } -static +static int TextStyle_Convert(PyObject *v, TextStylePtr p_itself) { long font, face, size; @@ -106,8 +106,8 @@ TextStyle_Convert(PyObject *v, TextStylePtr p_itself) /* ** Parse/generate RunInfo records */ -static -PyObject *RunInfo_New(WERunInfo *itself) +static PyObject * +RunInfo_New(WERunInfo *itself) { return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight, @@ -127,7 +127,7 @@ LongRect_New(LongRect *r) return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom); } - +int LongPt_Convert(PyObject *v, LongPt *p) { return PyArg_Parse(v, "(ll)", &p->h, &p->v); @@ -186,8 +186,12 @@ my_new_handler(Point *objectSize, WEObjectReference objref) if (!PyMac_GetPoint(rv, objectSize) ) err = errAECoercionFail; } - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -199,8 +203,12 @@ my_dispose_handler(WEObjectReference objref) args=Py_BuildValue("(O&)", WEOObj_New, objref); err = any_handler(weDisposeHandler, objref, args, &rv); - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -212,8 +220,12 @@ my_draw_handler(const Rect *destRect, WEObjectReference objref) args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref); err = any_handler(weDrawHandler, objref, args, &rv); - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return err; } @@ -232,8 +244,12 @@ my_click_handler(Point hitPt, EventModifiers modifiers, retvalue = PyInt_AsLong(rv); else retvalue = 0; - if ( args ) Py_DECREF(args); - if ( rv ) Py_DECREF(rv); + if ( args ) { + Py_DECREF(args); + } + if ( rv ) { + Py_DECREF(rv); + } return retvalue; } @@ -359,7 +375,8 @@ stdhandlers_body = """ (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr) goto cleanup; Py_INCREF(Py_None); - return Py_None; + _res = Py_None; + return _res; cleanup: return PyMac_Error(err); @@ -397,7 +414,8 @@ inshandler_body = """ err = WEInstallObjectHandler(objectType, selector, handler, we); if ( err ) return PyMac_Error(err); Py_INCREF(Py_None); - return Py_None; + _res = Py_None; + return _res; """ stdhand = ManualGenerator("STDObjectHandlers", stdhandlers_body) diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c index c0401e0f16b..258845d9867 100644 --- a/Mac/Modules/win/_Winmodule.c +++ b/Mac/Modules/win/_Winmodule.c @@ -110,7 +110,7 @@ static void WinObj_dealloc(WindowObject *self) } self->ob_itself = NULL; self->ob_freeit = NULL; - PyObject_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args) @@ -3223,6 +3223,7 @@ void init_Win(void) PyDict_SetItemString(d, "Error", Win_Error) != 0) return; Window_Type.ob_type = &PyType_Type; + if (PyType_Ready(&Window_Type) < 0) return; Py_INCREF(&Window_Type); PyModule_AddObject(m, "Window", (PyObject *)&Window_Type); /* Backward-compatible name */