diff options
Diffstat (limited to 'Mac/Modules/app')
-rw-r--r-- | Mac/Modules/app/_Appmodule.c | 55 | ||||
-rw-r--r-- | Mac/Modules/app/appsupport.py | 2 |
2 files changed, 43 insertions, 14 deletions
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c index da6c339..43d18e7 100644 --- a/Mac/Modules/app/_Appmodule.c +++ b/Mac/Modules/app/_Appmodule.c @@ -115,11 +115,30 @@ static PyMethodDef ThemeDrawingStateObj_methods[] = { #define ThemeDrawingStateObj_getsetlist NULL + #define ThemeDrawingStateObj_compare NULL #define ThemeDrawingStateObj_repr NULL #define ThemeDrawingStateObj_hash NULL +#define ThemeDrawingStateObj_tp_init 0 + +#define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc + +static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PyObject *self; + ThemeDrawingState itself; + char *kw[] = {"itself", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL; + if ((self = type->tp_alloc(type, 0)) == NULL) return NULL; + ((ThemeDrawingStateObject *)self)->ob_itself = itself; + return self; +} + +#define ThemeDrawingStateObj_tp_free PyObject_Del + PyTypeObject ThemeDrawingState_Type = { PyObject_HEAD_INIT(NULL) @@ -142,19 +161,27 @@ PyTypeObject ThemeDrawingState_Type = { 0, /*tp_str*/ PyObject_GenericGetAttr, /*tp_getattro*/ PyObject_GenericSetAttr, /*tp_setattro */ - 0, /*outputHook_tp_as_buffer*/ - 0, /*outputHook_tp_flags*/ - 0, /*outputHook_tp_doc*/ - 0, /*outputHook_tp_traverse*/ - 0, /*outputHook_tp_clear*/ - 0, /*outputHook_tp_richcompare*/ - 0, /*outputHook_tp_weaklistoffset*/ - 0, /*outputHook_tp_iter*/ - 0, /*outputHook_tp_iternext*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ ThemeDrawingStateObj_methods, /* tp_methods */ - 0, /*outputHook_tp_members*/ + 0, /*tp_members*/ ThemeDrawingStateObj_getsetlist, /*tp_getset*/ - 0, /*outputHook_tp_base*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + ThemeDrawingStateObj_tp_init, /* tp_init */ + ThemeDrawingStateObj_tp_alloc, /* tp_alloc */ + ThemeDrawingStateObj_tp_new, /* tp_new */ + ThemeDrawingStateObj_tp_free, /* tp_free */ }; /* --------------- End object type ThemeDrawingState ---------------- */ @@ -1822,8 +1849,10 @@ void init_App(void) return; ThemeDrawingState_Type.ob_type = &PyType_Type; Py_INCREF(&ThemeDrawingState_Type); - if (PyDict_SetItemString(d, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type) != 0) - Py_FatalError("can't initialize ThemeDrawingStateType"); + PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type); + /* Backward-compatible name */ + Py_INCREF(&ThemeDrawingState_Type); + PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type); } /* ======================== End module _App ========================= */ diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py index b6545ef..dc8ae4f 100644 --- a/Mac/Modules/app/appsupport.py +++ b/Mac/Modules/app/appsupport.py @@ -94,7 +94,7 @@ int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself) """ -class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): +class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition): pass ## def outputCheckNewArg(self): ## Output("if (itself == NULL) return PyMac_Error(resNotFound);") |