Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b734869

Browse files
committed
- Various tweaks to shut up compiler warnings.
- Regenerated with the correct calls to PyType_Ready and the correct deallocator calls.
1 parent 74d93c8 commit b734869

27 files changed

Lines changed: 157 additions & 86 deletions

Mac/Modules/Nav.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,20 +338,20 @@ navrr_getattr(navrrobject *self, char *name)
338338
PyObject *rv, *rvitem;
339339
AEDesc desc;
340340

341-
if (err=AECountItems(&self->itself.selection, &count)) {
341+
if ((err=AECountItems(&self->itself.selection, &count))) {
342342
PyErr_Mac(ErrorObject, err);
343343
return NULL;
344344
}
345345
if ( (rv=PyList_New(count)) == NULL )
346346
return NULL;
347347
for(i=0; i<count; i++) {
348348
desc.dataHandle = NULL;
349-
if (err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &desc)) {
349+
if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &desc))) {
350350
Py_DECREF(rv);
351351
PyErr_Mac(ErrorObject, err);
352352
return NULL;
353353
}
354-
if (err=AEGetDescData(&desc, &fss, sizeof(FSSpec))) {
354+
if ((err=AEGetDescData(&desc, &fss, sizeof(FSSpec)))) {
355355
Py_DECREF(rv);
356356
PyErr_Mac(ErrorObject, err);
357357
return NULL;
@@ -368,20 +368,20 @@ navrr_getattr(navrrobject *self, char *name)
368368
PyObject *rv, *rvitem;
369369
AEDesc desc;
370370

371-
if (err=AECountItems(&self->itself.selection, &count)) {
371+
if ((err=AECountItems(&self->itself.selection, &count))) {
372372
PyErr_Mac(ErrorObject, err);
373373
return NULL;
374374
}
375375
if ( (rv=PyList_New(count)) == NULL )
376376
return NULL;
377377
for(i=0; i<count; i++) {
378378
desc.dataHandle = NULL;
379-
if (err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc)) {
379+
if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc))) {
380380
Py_DECREF(rv);
381381
PyErr_Mac(ErrorObject, err);
382382
return NULL;
383383
}
384-
if (err=AEGetDescData(&desc, &fsr, sizeof(FSRef))) {
384+
if ((err=AEGetDescData(&desc, &fsr, sizeof(FSRef)))) {
385385
Py_DECREF(rv);
386386
PyErr_Mac(ErrorObject, err);
387387
return NULL;

Mac/Modules/ae/_AEmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int AEDesc_Convert(PyObject *v, AEDesc *p_itself)
9494
static void AEDesc_dealloc(AEDescObject *self)
9595
{
9696
AEDisposeDesc(&self->ob_itself);
97-
PyObject_Del(self);
97+
self->ob_type->tp_free((PyObject *)self);
9898
}
9999

100100
static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args)
@@ -1434,6 +1434,7 @@ void init_AE(void)
14341434
PyDict_SetItemString(d, "Error", AE_Error) != 0)
14351435
return;
14361436
AEDesc_Type.ob_type = &PyType_Type;
1437+
if (PyType_Ready(&AEDesc_Type) < 0) return;
14371438
Py_INCREF(&AEDesc_Type);
14381439
PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
14391440
/* Backward-compatible name */

Mac/Modules/app/_Appmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself)
6969
static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self)
7070
{
7171
/* Cleanup of self->ob_itself goes here */
72-
PyObject_Del(self);
72+
self->ob_type->tp_free((PyObject *)self);
7373
}
7474

7575
static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
@@ -1818,6 +1818,7 @@ void init_App(void)
18181818
PyDict_SetItemString(d, "Error", App_Error) != 0)
18191819
return;
18201820
ThemeDrawingState_Type.ob_type = &PyType_Type;
1821+
if (PyType_Ready(&ThemeDrawingState_Type) < 0) return;
18211822
Py_INCREF(&ThemeDrawingState_Type);
18221823
PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
18231824
/* Backward-compatible name */

Mac/Modules/carbonevt/CarbonEvtsupport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ class MyGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
357357
#endif /* USE_MAC_MP_MULTITHREADING */
358358
359359
Py_INCREF(Py_None);
360-
361-
return Py_None;
360+
_res = Py_None;
361+
return _res;
362362
"""
363363

364364
f = ManualGenerator("RunApplicationEventLoop", runappeventloop);

Mac/Modules/carbonevt/_CarbonEvtmodule.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int EventRef_Convert(PyObject *v, EventRef *p_itself)
171171
static void EventRef_dealloc(EventRefObject *self)
172172
{
173173
/* Cleanup of self->ob_itself goes here */
174-
PyObject_Del(self);
174+
self->ob_type->tp_free((PyObject *)self);
175175
}
176176

177177
static PyObject *EventRef_RetainEvent(EventRefObject *_self, PyObject *_args)
@@ -515,7 +515,7 @@ int EventQueueRef_Convert(PyObject *v, EventQueueRef *p_itself)
515515
static void EventQueueRef_dealloc(EventQueueRefObject *self)
516516
{
517517
/* Cleanup of self->ob_itself goes here */
518-
PyObject_Del(self);
518+
self->ob_type->tp_free((PyObject *)self);
519519
}
520520

521521
static PyObject *EventQueueRef_PostEventToQueue(EventQueueRefObject *_self, PyObject *_args)
@@ -735,7 +735,7 @@ int EventLoopRef_Convert(PyObject *v, EventLoopRef *p_itself)
735735
static void EventLoopRef_dealloc(EventLoopRefObject *self)
736736
{
737737
/* Cleanup of self->ob_itself goes here */
738-
PyObject_Del(self);
738+
self->ob_type->tp_free((PyObject *)self);
739739
}
740740

741741
static PyObject *EventLoopRef_QuitEventLoop(EventLoopRefObject *_self, PyObject *_args)
@@ -864,7 +864,7 @@ int EventLoopTimerRef_Convert(PyObject *v, EventLoopTimerRef *p_itself)
864864
static void EventLoopTimerRef_dealloc(EventLoopTimerRefObject *self)
865865
{
866866
/* Cleanup of self->ob_itself goes here */
867-
PyObject_Del(self);
867+
self->ob_type->tp_free((PyObject *)self);
868868
}
869869

870870
static PyObject *EventLoopTimerRef_RemoveEventLoopTimer(EventLoopTimerRefObject *_self, PyObject *_args)
@@ -1016,7 +1016,7 @@ static void EventHandlerRef_dealloc(EventHandlerRefObject *self)
10161016
RemoveEventHandler(self->ob_itself);
10171017
Py_DECREF(self->ob_callback);
10181018
}
1019-
PyObject_Del(self);
1019+
self->ob_type->tp_free((PyObject *)self);
10201020
}
10211021

10221022
static PyObject *EventHandlerRef_AddEventTypesToHandler(EventHandlerRefObject *_self, PyObject *_args)
@@ -1203,7 +1203,7 @@ int EventHandlerCallRef_Convert(PyObject *v, EventHandlerCallRef *p_itself)
12031203
static void EventHandlerCallRef_dealloc(EventHandlerCallRefObject *self)
12041204
{
12051205
/* Cleanup of self->ob_itself goes here */
1206-
PyObject_Del(self);
1206+
self->ob_type->tp_free((PyObject *)self);
12071207
}
12081208

12091209
static PyObject *EventHandlerCallRef_CallNextEventHandler(EventHandlerCallRefObject *_self, PyObject *_args)
@@ -1335,7 +1335,7 @@ int EventTargetRef_Convert(PyObject *v, EventTargetRef *p_itself)
13351335
static void EventTargetRef_dealloc(EventTargetRefObject *self)
13361336
{
13371337
/* Cleanup of self->ob_itself goes here */
1338-
PyObject_Del(self);
1338+
self->ob_type->tp_free((PyObject *)self);
13391339
}
13401340

13411341
static PyObject *EventTargetRef_InstallStandardEventHandler(EventTargetRefObject *_self, PyObject *_args)
@@ -1489,7 +1489,7 @@ int EventHotKeyRef_Convert(PyObject *v, EventHotKeyRef *p_itself)
14891489
static void EventHotKeyRef_dealloc(EventHotKeyRefObject *self)
14901490
{
14911491
/* Cleanup of self->ob_itself goes here */
1492-
PyObject_Del(self);
1492+
self->ob_type->tp_free((PyObject *)self);
14931493
}
14941494

14951495
static PyObject *EventHotKeyRef_UnregisterEventHotKey(EventHotKeyRefObject *_self, PyObject *_args)
@@ -2067,8 +2067,8 @@ static PyObject *CarbonEvents_RunApplicationEventLoop(PyObject *_self, PyObject
20672067
#endif /* USE_MAC_MP_MULTITHREADING */
20682068

20692069
Py_INCREF(Py_None);
2070-
2071-
return Py_None;
2070+
_res = Py_None;
2071+
return _res;
20722072

20732073
}
20742074

@@ -2157,48 +2157,56 @@ void init_CarbonEvt(void)
21572157
PyDict_SetItemString(d, "Error", CarbonEvents_Error) != 0)
21582158
return;
21592159
EventRef_Type.ob_type = &PyType_Type;
2160+
if (PyType_Ready(&EventRef_Type) < 0) return;
21602161
Py_INCREF(&EventRef_Type);
21612162
PyModule_AddObject(m, "EventRef", (PyObject *)&EventRef_Type);
21622163
/* Backward-compatible name */
21632164
Py_INCREF(&EventRef_Type);
21642165
PyModule_AddObject(m, "EventRefType", (PyObject *)&EventRef_Type);
21652166
EventQueueRef_Type.ob_type = &PyType_Type;
2167+
if (PyType_Ready(&EventQueueRef_Type) < 0) return;
21662168
Py_INCREF(&EventQueueRef_Type);
21672169
PyModule_AddObject(m, "EventQueueRef", (PyObject *)&EventQueueRef_Type);
21682170
/* Backward-compatible name */
21692171
Py_INCREF(&EventQueueRef_Type);
21702172
PyModule_AddObject(m, "EventQueueRefType", (PyObject *)&EventQueueRef_Type);
21712173
EventLoopRef_Type.ob_type = &PyType_Type;
2174+
if (PyType_Ready(&EventLoopRef_Type) < 0) return;
21722175
Py_INCREF(&EventLoopRef_Type);
21732176
PyModule_AddObject(m, "EventLoopRef", (PyObject *)&EventLoopRef_Type);
21742177
/* Backward-compatible name */
21752178
Py_INCREF(&EventLoopRef_Type);
21762179
PyModule_AddObject(m, "EventLoopRefType", (PyObject *)&EventLoopRef_Type);
21772180
EventLoopTimerRef_Type.ob_type = &PyType_Type;
2181+
if (PyType_Ready(&EventLoopTimerRef_Type) < 0) return;
21782182
Py_INCREF(&EventLoopTimerRef_Type);
21792183
PyModule_AddObject(m, "EventLoopTimerRef", (PyObject *)&EventLoopTimerRef_Type);
21802184
/* Backward-compatible name */
21812185
Py_INCREF(&EventLoopTimerRef_Type);
21822186
PyModule_AddObject(m, "EventLoopTimerRefType", (PyObject *)&EventLoopTimerRef_Type);
21832187
EventHandlerRef_Type.ob_type = &PyType_Type;
2188+
if (PyType_Ready(&EventHandlerRef_Type) < 0) return;
21842189
Py_INCREF(&EventHandlerRef_Type);
21852190
PyModule_AddObject(m, "EventHandlerRef", (PyObject *)&EventHandlerRef_Type);
21862191
/* Backward-compatible name */
21872192
Py_INCREF(&EventHandlerRef_Type);
21882193
PyModule_AddObject(m, "EventHandlerRefType", (PyObject *)&EventHandlerRef_Type);
21892194
EventHandlerCallRef_Type.ob_type = &PyType_Type;
2195+
if (PyType_Ready(&EventHandlerCallRef_Type) < 0) return;
21902196
Py_INCREF(&EventHandlerCallRef_Type);
21912197
PyModule_AddObject(m, "EventHandlerCallRef", (PyObject *)&EventHandlerCallRef_Type);
21922198
/* Backward-compatible name */
21932199
Py_INCREF(&EventHandlerCallRef_Type);
21942200
PyModule_AddObject(m, "EventHandlerCallRefType", (PyObject *)&EventHandlerCallRef_Type);
21952201
EventTargetRef_Type.ob_type = &PyType_Type;
2202+
if (PyType_Ready(&EventTargetRef_Type) < 0) return;
21962203
Py_INCREF(&EventTargetRef_Type);
21972204
PyModule_AddObject(m, "EventTargetRef", (PyObject *)&EventTargetRef_Type);
21982205
/* Backward-compatible name */
21992206
Py_INCREF(&EventTargetRef_Type);
22002207
PyModule_AddObject(m, "EventTargetRefType", (PyObject *)&EventTargetRef_Type);
22012208
EventHotKeyRef_Type.ob_type = &PyType_Type;
2209+
if (PyType_Ready(&EventHotKeyRef_Type) < 0) return;
22022210
Py_INCREF(&EventHotKeyRef_Type);
22032211
PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type);
22042212
/* Backward-compatible name */

Mac/Modules/cg/_CGmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself)
241241
static void CGContextRefObj_dealloc(CGContextRefObject *self)
242242
{
243243
CGContextRelease(self->ob_itself);
244-
PyObject_Del(self);
244+
self->ob_type->tp_free((PyObject *)self);
245245
}
246246

247247
static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args)
@@ -1399,6 +1399,7 @@ void init_CG(void)
13991399
PyDict_SetItemString(d, "Error", CG_Error) != 0)
14001400
return;
14011401
CGContextRef_Type.ob_type = &PyType_Type;
1402+
if (PyType_Ready(&CGContextRef_Type) < 0) return;
14021403
Py_INCREF(&CGContextRef_Type);
14031404
PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
14041405
/* Backward-compatible name */

Mac/Modules/cm/_Cmmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself)
102102
static void CmpInstObj_dealloc(ComponentInstanceObject *self)
103103
{
104104
/* Cleanup of self->ob_itself goes here */
105-
PyObject_Del(self);
105+
self->ob_type->tp_free((PyObject *)self);
106106
}
107107

108108
static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args)
@@ -373,7 +373,7 @@ int CmpObj_Convert(PyObject *v, Component *p_itself)
373373
static void CmpObj_dealloc(ComponentObject *self)
374374
{
375375
/* Cleanup of self->ob_itself goes here */
376-
PyObject_Del(self);
376+
self->ob_type->tp_free((PyObject *)self);
377377
}
378378

379379
static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args)
@@ -935,12 +935,14 @@ void init_Cm(void)
935935
PyDict_SetItemString(d, "Error", Cm_Error) != 0)
936936
return;
937937
ComponentInstance_Type.ob_type = &PyType_Type;
938+
if (PyType_Ready(&ComponentInstance_Type) < 0) return;
938939
Py_INCREF(&ComponentInstance_Type);
939940
PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type);
940941
/* Backward-compatible name */
941942
Py_INCREF(&ComponentInstance_Type);
942943
PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type);
943944
Component_Type.ob_type = &PyType_Type;
945+
if (PyType_Ready(&Component_Type) < 0) return;
944946
Py_INCREF(&Component_Type);
945947
PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
946948
/* Backward-compatible name */

Mac/Modules/ctl/_Ctlmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static void CtlObj_dealloc(ControlObject *self)
179179
{
180180
Py_XDECREF(self->ob_callbackdict);
181181
if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
182-
PyObject_Del(self);
182+
self->ob_type->tp_free((PyObject *)self);
183183
}
184184

185185
static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
@@ -5849,6 +5849,7 @@ void init_Ctl(void)
58495849
PyDict_SetItemString(d, "Error", Ctl_Error) != 0)
58505850
return;
58515851
Control_Type.ob_type = &PyType_Type;
5852+
if (PyType_Ready(&Control_Type) < 0) return;
58525853
Py_INCREF(&Control_Type);
58535854
PyModule_AddObject(m, "Control", (PyObject *)&Control_Type);
58545855
/* Backward-compatible name */

Mac/Modules/dlg/_Dlgmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
172172
static void DlgObj_dealloc(DialogObject *self)
173173
{
174174
DisposeDialog(self->ob_itself);
175-
PyObject_Del(self);
175+
self->ob_type->tp_free((PyObject *)self);
176176
}
177177

178178
static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args)
@@ -1590,6 +1590,7 @@ void init_Dlg(void)
15901590
PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
15911591
return;
15921592
Dialog_Type.ob_type = &PyType_Type;
1593+
if (PyType_Ready(&Dialog_Type) < 0) return;
15931594
Py_INCREF(&Dialog_Type);
15941595
PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type);
15951596
/* Backward-compatible name */

Mac/Modules/drag/_Dragmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int DragObj_Convert(PyObject *v, DragRef *p_itself)
8484
static void DragObj_dealloc(DragObjObject *self)
8585
{
8686
Py_XDECREF(self->sendproc);
87-
PyObject_Del(self);
87+
self->ob_type->tp_free((PyObject *)self);
8888
}
8989

9090
static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args)
@@ -1135,6 +1135,7 @@ void init_Drag(void)
11351135
PyDict_SetItemString(d, "Error", Drag_Error) != 0)
11361136
return;
11371137
DragObj_Type.ob_type = &PyType_Type;
1138+
if (PyType_Ready(&DragObj_Type) < 0) return;
11381139
Py_INCREF(&DragObj_Type);
11391140
PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
11401141
/* Backward-compatible name */

0 commit comments

Comments
 (0)