summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-12-03 23:40:22 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-12-03 23:40:22 (GMT)
commit96cebde909bbb8034af576d8f31f465bbad90374 (patch)
tree305f0e665ac5676a19485cf662920a7db5c19eee
parent99899b92b86ee69f0b46b708a465f445059dc793 (diff)
downloadcpython-96cebde909bbb8034af576d8f31f465bbad90374.zip
cpython-96cebde909bbb8034af576d8f31f465bbad90374.tar.gz
cpython-96cebde909bbb8034af576d8f31f465bbad90374.tar.bz2
Added PEP253 support to most Carbon modules. This isn't complete yet:
some of the more compilcated cases (CF, Res) haven't been done yet. Also, various types should inherit from each other (anything with an as_Resource method should be a Resource subtype, the CF types should become one family).
-rw-r--r--Mac/Modules/ae/_AEmodule.c54
-rw-r--r--Mac/Modules/ae/aesupport.py2
-rw-r--r--Mac/Modules/alias/_Aliasmodule.c55
-rw-r--r--Mac/Modules/alias/aliassupport.py3
-rw-r--r--Mac/Modules/app/_Appmodule.c55
-rw-r--r--Mac/Modules/app/appsupport.py2
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtsupport.py4
-rwxr-xr-xMac/Modules/carbonevt/_CarbonEvtmodule.c440
-rw-r--r--Mac/Modules/cf/_CFmodule.c60
-rwxr-xr-xMac/Modules/cg/_CGmodule.c55
-rwxr-xr-xMac/Modules/cg/cgsupport.py2
-rw-r--r--Mac/Modules/cm/_Cmmodule.c110
-rw-r--r--Mac/Modules/cm/cmsupport.py4
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c55
-rw-r--r--Mac/Modules/ctl/ctlsupport.py2
-rw-r--r--Mac/Modules/dlg/_Dlgmodule.c55
-rw-r--r--Mac/Modules/dlg/dlgsupport.py2
-rw-r--r--Mac/Modules/drag/_Dragmodule.c55
-rw-r--r--Mac/Modules/drag/dragsupport.py2
-rw-r--r--Mac/Modules/help/helpsupport.py2
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonsupport.py4
-rw-r--r--Mac/Modules/ibcarbon/_IBCarbon.c55
-rw-r--r--Mac/Modules/icn/icnsupport.py2
-rw-r--r--Mac/Modules/list/_Listmodule.c54
-rw-r--r--Mac/Modules/list/listsupport.py3
-rw-r--r--Mac/Modules/menu/_Menumodule.c55
-rw-r--r--Mac/Modules/menu/menusupport.py2
-rw-r--r--Mac/Modules/mlte/_Mltemodule.c110
-rw-r--r--Mac/Modules/mlte/mltesupport.py4
-rw-r--r--Mac/Modules/qd/_Qdmodule.c108
-rw-r--r--Mac/Modules/qd/qdsupport.py4
-rw-r--r--Mac/Modules/qdoffs/_Qdoffsmodule.c55
-rw-r--r--Mac/Modules/qdoffs/qdoffssupport.py3
-rw-r--r--Mac/Modules/qt/_Qtmodule.c330
-rw-r--r--Mac/Modules/qt/qtsupport.py12
-rw-r--r--Mac/Modules/scrap/scrapsupport.py2
-rw-r--r--Mac/Modules/snd/_Sndmodule.c73
-rw-r--r--Mac/Modules/te/_TEmodule.c55
-rw-r--r--Mac/Modules/te/tesupport.py3
-rw-r--r--Mac/Modules/waste/wastemodule.c110
-rw-r--r--Mac/Modules/waste/wastesupport.py4
-rw-r--r--Mac/Modules/win/_Winmodule.c56
-rw-r--r--Mac/Modules/win/winsupport.py3
43 files changed, 1592 insertions, 534 deletions
diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c
index db8239c..1a0f107 100644
--- a/Mac/Modules/ae/_AEmodule.c
+++ b/Mac/Modules/ae/_AEmodule.c
@@ -869,6 +869,24 @@ static PyGetSetDef AEDesc_getsetlist[] = {
#define AEDesc_repr NULL
#define AEDesc_hash NULL
+#define AEDesc_tp_init 0
+
+#define AEDesc_tp_alloc PyType_GenericAlloc
+
+static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ AEDesc itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, AEDesc_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((AEDescObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define AEDesc_tp_free PyObject_Del
+
PyTypeObject AEDesc_Type = {
PyObject_HEAD_INIT(NULL)
@@ -891,19 +909,27 @@ PyTypeObject AEDesc_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*/
AEDesc_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
AEDesc_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ AEDesc_tp_init, /* tp_init */
+ AEDesc_tp_alloc, /* tp_alloc */
+ AEDesc_tp_new, /* tp_new */
+ AEDesc_tp_free, /* tp_free */
};
/* --------------------- End object type AEDesc --------------------- */
@@ -1429,8 +1455,10 @@ void init_AE(void)
return;
AEDesc_Type.ob_type = &PyType_Type;
Py_INCREF(&AEDesc_Type);
- if (PyDict_SetItemString(d, "AEDescType", (PyObject *)&AEDesc_Type) != 0)
- Py_FatalError("can't initialize AEDescType");
+ PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&AEDesc_Type);
+ PyModule_AddObject(m, "AEDescType", (PyObject *)&AEDesc_Type);
}
/* ========================= End module _AE ========================= */
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index e6c4efe..346340b 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -174,7 +174,7 @@ initstuff = initstuff + """
module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff)
-class AEDescDefinition(PEP252Mixin, GlobalObjectDefinition):
+class AEDescDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [(
'type',
'return PyMac_BuildOSType(self->ob_itself.descriptorType);',
diff --git a/Mac/Modules/alias/_Aliasmodule.c b/Mac/Modules/alias/_Aliasmodule.c
index 91e0f28..a35d5d0 100644
--- a/Mac/Modules/alias/_Aliasmodule.c
+++ b/Mac/Modules/alias/_Aliasmodule.c
@@ -97,11 +97,30 @@ static PyMethodDef AliasObj_methods[] = {
#define AliasObj_getsetlist NULL
+
#define AliasObj_compare NULL
#define AliasObj_repr NULL
#define AliasObj_hash NULL
+#define AliasObj_tp_init 0
+
+#define AliasObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *AliasObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ AliasHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, AliasObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((AliasObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define AliasObj_tp_free PyObject_Del
+
PyTypeObject Alias_Type = {
PyObject_HEAD_INIT(NULL)
@@ -124,19 +143,27 @@ PyTypeObject Alias_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*/
AliasObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
AliasObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ AliasObj_tp_init, /* tp_init */
+ AliasObj_tp_alloc, /* tp_alloc */
+ AliasObj_tp_new, /* tp_new */
+ AliasObj_tp_free, /* tp_free */
};
/* --------------------- End object type Alias ---------------------- */
@@ -665,8 +692,10 @@ void init_Alias(void)
return;
Alias_Type.ob_type = &PyType_Type;
Py_INCREF(&Alias_Type);
- if (PyDict_SetItemString(d, "AliasType", (PyObject *)&Alias_Type) != 0)
- Py_FatalError("can't initialize AliasType");
+ PyModule_AddObject(m, "Alias", (PyObject *)&Alias_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Alias_Type);
+ PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
}
/* ======================= End module _Alias ======================== */
diff --git a/Mac/Modules/alias/aliassupport.py b/Mac/Modules/alias/aliassupport.py
index 7fd6f84..d019c36 100644
--- a/Mac/Modules/alias/aliassupport.py
+++ b/Mac/Modules/alias/aliassupport.py
@@ -72,7 +72,8 @@ execfile(string.lower(MODPREFIX) + 'typetest.py')
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
-class AliasDefinition(PEP252Mixin, GlobalObjectDefinition):
+class AliasDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Should inherit from resource?
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
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);")
diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py
index e3ac5f5..7653b08 100644
--- a/Mac/Modules/carbonevt/CarbonEvtsupport.py
+++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py
@@ -215,7 +215,7 @@ module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, inits
-class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class EventHandlerRefObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
Output("%s ob_itself;", self.itselftype)
Output("PyObject *ob_callback;")
@@ -228,7 +228,7 @@ class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
Output("Py_DECREF(self->ob_callback);")
OutRbrace()
-class MyGlobalObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
for typ in RefObjectTypes:
diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
index 05ad7fb..2fa1e2c 100755
--- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c
+++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
@@ -410,11 +410,30 @@ static PyMethodDef EventRef_methods[] = {
#define EventRef_getsetlist NULL
+
#define EventRef_compare NULL
#define EventRef_repr NULL
#define EventRef_hash NULL
+#define EventRef_tp_init 0
+
+#define EventRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventRef_tp_free PyObject_Del
+
PyTypeObject EventRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -437,19 +456,27 @@ PyTypeObject EventRef_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*/
EventRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventRef_tp_init, /* tp_init */
+ EventRef_tp_alloc, /* tp_alloc */
+ EventRef_tp_new, /* tp_new */
+ EventRef_tp_free, /* tp_free */
};
/* -------------------- End object type EventRef -------------------- */
@@ -603,11 +630,30 @@ static PyMethodDef EventQueueRef_methods[] = {
#define EventQueueRef_getsetlist NULL
+
#define EventQueueRef_compare NULL
#define EventQueueRef_repr NULL
#define EventQueueRef_hash NULL
+#define EventQueueRef_tp_init 0
+
+#define EventQueueRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventQueueRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventQueueRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventQueueRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventQueueRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventQueueRef_tp_free PyObject_Del
+
PyTypeObject EventQueueRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -630,19 +676,27 @@ PyTypeObject EventQueueRef_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*/
EventQueueRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventQueueRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventQueueRef_tp_init, /* tp_init */
+ EventQueueRef_tp_alloc, /* tp_alloc */
+ EventQueueRef_tp_new, /* tp_new */
+ EventQueueRef_tp_free, /* tp_free */
};
/* ----------------- End object type EventQueueRef ------------------ */
@@ -705,11 +759,30 @@ static PyMethodDef EventLoopRef_methods[] = {
#define EventLoopRef_getsetlist NULL
+
#define EventLoopRef_compare NULL
#define EventLoopRef_repr NULL
#define EventLoopRef_hash NULL
+#define EventLoopRef_tp_init 0
+
+#define EventLoopRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventLoopRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventLoopRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventLoopRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventLoopRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventLoopRef_tp_free PyObject_Del
+
PyTypeObject EventLoopRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -732,19 +805,27 @@ PyTypeObject EventLoopRef_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*/
EventLoopRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventLoopRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventLoopRef_tp_init, /* tp_init */
+ EventLoopRef_tp_alloc, /* tp_alloc */
+ EventLoopRef_tp_new, /* tp_new */
+ EventLoopRef_tp_free, /* tp_free */
};
/* ------------------ End object type EventLoopRef ------------------ */
@@ -825,11 +906,30 @@ static PyMethodDef EventLoopTimerRef_methods[] = {
#define EventLoopTimerRef_getsetlist NULL
+
#define EventLoopTimerRef_compare NULL
#define EventLoopTimerRef_repr NULL
#define EventLoopTimerRef_hash NULL
+#define EventLoopTimerRef_tp_init 0
+
+#define EventLoopTimerRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventLoopTimerRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventLoopTimerRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventLoopTimerRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventLoopTimerRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventLoopTimerRef_tp_free PyObject_Del
+
PyTypeObject EventLoopTimerRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -852,19 +952,27 @@ PyTypeObject EventLoopTimerRef_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*/
EventLoopTimerRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventLoopTimerRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventLoopTimerRef_tp_init, /* tp_init */
+ EventLoopTimerRef_tp_alloc, /* tp_alloc */
+ EventLoopTimerRef_tp_new, /* tp_new */
+ EventLoopTimerRef_tp_free, /* tp_free */
};
/* --------------- End object type EventLoopTimerRef ---------------- */
@@ -990,11 +1098,30 @@ static PyMethodDef EventHandlerRef_methods[] = {
#define EventHandlerRef_getsetlist NULL
+
#define EventHandlerRef_compare NULL
#define EventHandlerRef_repr NULL
#define EventHandlerRef_hash NULL
+#define EventHandlerRef_tp_init 0
+
+#define EventHandlerRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHandlerRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventHandlerRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventHandlerRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHandlerRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventHandlerRef_tp_free PyObject_Del
+
PyTypeObject EventHandlerRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1017,19 +1144,27 @@ PyTypeObject EventHandlerRef_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*/
EventHandlerRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventHandlerRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHandlerRef_tp_init, /* tp_init */
+ EventHandlerRef_tp_alloc, /* tp_alloc */
+ EventHandlerRef_tp_new, /* tp_new */
+ EventHandlerRef_tp_free, /* tp_free */
};
/* ---------------- End object type EventHandlerRef ----------------- */
@@ -1095,11 +1230,30 @@ static PyMethodDef EventHandlerCallRef_methods[] = {
#define EventHandlerCallRef_getsetlist NULL
+
#define EventHandlerCallRef_compare NULL
#define EventHandlerCallRef_repr NULL
#define EventHandlerCallRef_hash NULL
+#define EventHandlerCallRef_tp_init 0
+
+#define EventHandlerCallRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHandlerCallRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventHandlerCallRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventHandlerCallRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHandlerCallRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventHandlerCallRef_tp_free PyObject_Del
+
PyTypeObject EventHandlerCallRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1122,19 +1276,27 @@ PyTypeObject EventHandlerCallRef_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*/
EventHandlerCallRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventHandlerCallRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHandlerCallRef_tp_init, /* tp_init */
+ EventHandlerCallRef_tp_alloc, /* tp_alloc */
+ EventHandlerCallRef_tp_new, /* tp_new */
+ EventHandlerCallRef_tp_free, /* tp_free */
};
/* -------------- End object type EventHandlerCallRef --------------- */
@@ -1222,11 +1384,30 @@ static PyMethodDef EventTargetRef_methods[] = {
#define EventTargetRef_getsetlist NULL
+
#define EventTargetRef_compare NULL
#define EventTargetRef_repr NULL
#define EventTargetRef_hash NULL
+#define EventTargetRef_tp_init 0
+
+#define EventTargetRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventTargetRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventTargetRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventTargetRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventTargetRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventTargetRef_tp_free PyObject_Del
+
PyTypeObject EventTargetRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1249,19 +1430,27 @@ PyTypeObject EventTargetRef_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*/
EventTargetRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventTargetRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventTargetRef_tp_init, /* tp_init */
+ EventTargetRef_tp_alloc, /* tp_alloc */
+ EventTargetRef_tp_new, /* tp_new */
+ EventTargetRef_tp_free, /* tp_free */
};
/* ----------------- End object type EventTargetRef ----------------- */
@@ -1324,11 +1513,30 @@ static PyMethodDef EventHotKeyRef_methods[] = {
#define EventHotKeyRef_getsetlist NULL
+
#define EventHotKeyRef_compare NULL
#define EventHotKeyRef_repr NULL
#define EventHotKeyRef_hash NULL
+#define EventHotKeyRef_tp_init 0
+
+#define EventHotKeyRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHotKeyRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ EventHotKeyRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, EventHotKeyRef_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHotKeyRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define EventHotKeyRef_tp_free PyObject_Del
+
PyTypeObject EventHotKeyRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1351,19 +1559,27 @@ PyTypeObject EventHotKeyRef_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*/
EventHotKeyRef_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
EventHotKeyRef_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHotKeyRef_tp_init, /* tp_init */
+ EventHotKeyRef_tp_alloc, /* tp_alloc */
+ EventHotKeyRef_tp_new, /* tp_new */
+ EventHotKeyRef_tp_free, /* tp_free */
};
/* ----------------- End object type EventHotKeyRef ----------------- */
@@ -1942,36 +2158,52 @@ void init_CarbonEvt(void)
return;
EventRef_Type.ob_type = &PyType_Type;
Py_INCREF(&EventRef_Type);
- if (PyDict_SetItemString(d, "EventRefType", (PyObject *)&EventRef_Type) != 0)
- Py_FatalError("can't initialize EventRefType");
+ 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_INCREF(&EventQueueRef_Type);
- if (PyDict_SetItemString(d, "EventQueueRefType", (PyObject *)&EventQueueRef_Type) != 0)
- Py_FatalError("can't initialize EventQueueRefType");
+ 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_INCREF(&EventLoopRef_Type);
- if (PyDict_SetItemString(d, "EventLoopRefType", (PyObject *)&EventLoopRef_Type) != 0)
- Py_FatalError("can't initialize EventLoopRefType");
+ 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_INCREF(&EventLoopTimerRef_Type);
- if (PyDict_SetItemString(d, "EventLoopTimerRefType", (PyObject *)&EventLoopTimerRef_Type) != 0)
- Py_FatalError("can't initialize EventLoopTimerRefType");
+ 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_INCREF(&EventHandlerRef_Type);
- if (PyDict_SetItemString(d, "EventHandlerRefType", (PyObject *)&EventHandlerRef_Type) != 0)
- Py_FatalError("can't initialize EventHandlerRefType");
+ 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_INCREF(&EventHandlerCallRef_Type);
- if (PyDict_SetItemString(d, "EventHandlerCallRefType", (PyObject *)&EventHandlerCallRef_Type) != 0)
- Py_FatalError("can't initialize EventHandlerCallRefType");
+ 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_INCREF(&EventTargetRef_Type);
- if (PyDict_SetItemString(d, "EventTargetRefType", (PyObject *)&EventTargetRef_Type) != 0)
- Py_FatalError("can't initialize EventTargetRefType");
+ 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_INCREF(&EventHotKeyRef_Type);
- if (PyDict_SetItemString(d, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type) != 0)
- Py_FatalError("can't initialize EventHotKeyRefType");
+ PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventHotKeyRef_Type);
+ PyModule_AddObject(m, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type);
}
/* ===================== End module _CarbonEvt ====================== */
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
index 2942082..691378e 100644
--- a/Mac/Modules/cf/_CFmodule.c
+++ b/Mac/Modules/cf/_CFmodule.c
@@ -4325,44 +4325,64 @@ void init_CF(void)
return;
CFTypeRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFTypeRef_Type);
- if (PyDict_SetItemString(d, "CFTypeRefType", (PyObject *)&CFTypeRef_Type) != 0)
- Py_FatalError("can't initialize CFTypeRefType");
+ 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_INCREF(&CFArrayRef_Type);
- if (PyDict_SetItemString(d, "CFArrayRefType", (PyObject *)&CFArrayRef_Type) != 0)
- Py_FatalError("can't initialize CFArrayRefType");
+ PyModule_AddObject(m, "CFArrayRef", (PyObject *)&CFArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFArrayRef_Type);
+ PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type);
CFMutableArrayRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableArrayRef_Type);
- if (PyDict_SetItemString(d, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableArrayRefType");
+ PyModule_AddObject(m, "CFMutableArrayRef", (PyObject *)&CFMutableArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableArrayRef_Type);
+ PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type);
CFDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDictionaryRef_Type);
- if (PyDict_SetItemString(d, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type) != 0)
- Py_FatalError("can't initialize CFDictionaryRefType");
+ PyModule_AddObject(m, "CFDictionaryRef", (PyObject *)&CFDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDictionaryRef_Type);
+ PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type);
CFMutableDictionaryRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDictionaryRef_Type);
- if (PyDict_SetItemString(d, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableDictionaryRefType");
+ PyModule_AddObject(m, "CFMutableDictionaryRef", (PyObject *)&CFMutableDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDictionaryRef_Type);
+ PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type);
CFDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFDataRef_Type);
- if (PyDict_SetItemString(d, "CFDataRefType", (PyObject *)&CFDataRef_Type) != 0)
- Py_FatalError("can't initialize CFDataRefType");
+ PyModule_AddObject(m, "CFDataRef", (PyObject *)&CFDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDataRef_Type);
+ PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type);
CFMutableDataRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableDataRef_Type);
- if (PyDict_SetItemString(d, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableDataRefType");
+ PyModule_AddObject(m, "CFMutableDataRef", (PyObject *)&CFMutableDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDataRef_Type);
+ PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type);
CFStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFStringRef_Type);
- if (PyDict_SetItemString(d, "CFStringRefType", (PyObject *)&CFStringRef_Type) != 0)
- Py_FatalError("can't initialize CFStringRefType");
+ PyModule_AddObject(m, "CFStringRef", (PyObject *)&CFStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFStringRef_Type);
+ PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type);
CFMutableStringRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFMutableStringRef_Type);
- if (PyDict_SetItemString(d, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type) != 0)
- Py_FatalError("can't initialize CFMutableStringRefType");
+ PyModule_AddObject(m, "CFMutableStringRef", (PyObject *)&CFMutableStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableStringRef_Type);
+ PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type);
CFURLRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CFURLRef_Type);
- if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
- Py_FatalError("can't initialize CFURLRefType");
+ PyModule_AddObject(m, "CFURLRef", (PyObject *)&CFURLRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFURLRef_Type);
+ PyModule_AddObject(m, "CFURLRefType", (PyObject *)&CFURLRef_Type);
#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
_STRINGCONST(kCFPreferencesAnyApplication);
diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c
index b475d68..5642164 100755
--- a/Mac/Modules/cg/_CGmodule.c
+++ b/Mac/Modules/cg/_CGmodule.c
@@ -1268,11 +1268,30 @@ static PyMethodDef CGContextRefObj_methods[] = {
#define CGContextRefObj_getsetlist NULL
+
#define CGContextRefObj_compare NULL
#define CGContextRefObj_repr NULL
#define CGContextRefObj_hash NULL
+#define CGContextRefObj_tp_init 0
+
+#define CGContextRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CGContextRefObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ CGContextRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CGContextRefObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CGContextRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define CGContextRefObj_tp_free PyObject_Del
+
PyTypeObject CGContextRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1295,19 +1314,27 @@ PyTypeObject CGContextRef_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*/
CGContextRefObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
CGContextRefObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CGContextRefObj_tp_init, /* tp_init */
+ CGContextRefObj_tp_alloc, /* tp_alloc */
+ CGContextRefObj_tp_new, /* tp_new */
+ CGContextRefObj_tp_free, /* tp_free */
};
/* ------------------ End object type CGContextRef ------------------ */
@@ -1373,8 +1400,10 @@ void init_CG(void)
return;
CGContextRef_Type.ob_type = &PyType_Type;
Py_INCREF(&CGContextRef_Type);
- if (PyDict_SetItemString(d, "CGContextRefType", (PyObject *)&CGContextRef_Type) != 0)
- Py_FatalError("can't initialize CGContextRefType");
+ PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CGContextRef_Type);
+ PyModule_AddObject(m, "CGContextRefType", (PyObject *)&CGContextRef_Type);
}
/* ========================= End module _CG ========================= */
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
index ca347f7..7456b55 100755
--- a/Mac/Modules/cg/cgsupport.py
+++ b/Mac/Modules/cg/cgsupport.py
@@ -250,7 +250,7 @@ CGPathDrawingMode = int
CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputStructMembers(self):
ObjectDefinition.outputStructMembers(self)
def outputCleanupStructMembers(self):
diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c
index 5aaa79f..1737fef 100644
--- a/Mac/Modules/cm/_Cmmodule.c
+++ b/Mac/Modules/cm/_Cmmodule.c
@@ -307,11 +307,30 @@ static PyMethodDef CmpInstObj_methods[] = {
#define CmpInstObj_getsetlist NULL
+
#define CmpInstObj_compare NULL
#define CmpInstObj_repr NULL
#define CmpInstObj_hash NULL
+#define CmpInstObj_tp_init 0
+
+#define CmpInstObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CmpInstObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ ComponentInstance itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CmpInstObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ComponentInstanceObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define CmpInstObj_tp_free PyObject_Del
+
PyTypeObject ComponentInstance_Type = {
PyObject_HEAD_INIT(NULL)
@@ -334,19 +353,27 @@ PyTypeObject ComponentInstance_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*/
CmpInstObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
CmpInstObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CmpInstObj_tp_init, /* tp_init */
+ CmpInstObj_tp_alloc, /* tp_alloc */
+ CmpInstObj_tp_new, /* tp_new */
+ CmpInstObj_tp_free, /* tp_free */
};
/* --------------- End object type ComponentInstance ---------------- */
@@ -713,11 +740,30 @@ static PyMethodDef CmpObj_methods[] = {
#define CmpObj_getsetlist NULL
+
#define CmpObj_compare NULL
#define CmpObj_repr NULL
#define CmpObj_hash NULL
+#define CmpObj_tp_init 0
+
+#define CmpObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CmpObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ Component itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CmpObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ComponentObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define CmpObj_tp_free PyObject_Del
+
PyTypeObject Component_Type = {
PyObject_HEAD_INIT(NULL)
@@ -740,19 +786,27 @@ PyTypeObject Component_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*/
CmpObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
CmpObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CmpObj_tp_init, /* tp_init */
+ CmpObj_tp_alloc, /* tp_alloc */
+ CmpObj_tp_new, /* tp_new */
+ CmpObj_tp_free, /* tp_free */
};
/* ------------------- End object type Component -------------------- */
@@ -930,12 +984,16 @@ void init_Cm(void)
return;
ComponentInstance_Type.ob_type = &PyType_Type;
Py_INCREF(&ComponentInstance_Type);
- if (PyDict_SetItemString(d, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type) != 0)
- Py_FatalError("can't initialize ComponentInstanceType");
+ 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_INCREF(&Component_Type);
- if (PyDict_SetItemString(d, "ComponentType", (PyObject *)&Component_Type) != 0)
- Py_FatalError("can't initialize ComponentType");
+ PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Component_Type);
+ PyModule_AddObject(m, "ComponentType", (PyObject *)&Component_Type);
}
/* ========================= End module _Cm ========================= */
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
index ee6c342..2468193 100644
--- a/Mac/Modules/cm/cmsupport.py
+++ b/Mac/Modules/cm/cmsupport.py
@@ -79,14 +79,14 @@ ComponentResult = Type("ComponentResult", "l")
ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj")
-class MyCIObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyCIObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Cm_Error,"NULL ComponentInstance");
return NULL;
}""")
-class MyCObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyCObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
/* XXXX Or should we return None? */
diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c
index aa0af9e..9c1e041 100644
--- a/Mac/Modules/ctl/_Ctlmodule.c
+++ b/Mac/Modules/ctl/_Ctlmodule.c
@@ -4545,6 +4545,7 @@ static PyMethodDef CtlObj_methods[] = {
#define CtlObj_getsetlist NULL
+
static int CtlObj_compare(ControlObject *self, ControlObject *other)
{
unsigned long v, w;
@@ -4570,6 +4571,24 @@ static long CtlObj_hash(ControlObject *self)
{
return (long)self->ob_itself;
}
+#define CtlObj_tp_init 0
+
+#define CtlObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ ControlHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, CtlObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ControlObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define CtlObj_tp_free PyObject_Del
+
PyTypeObject Control_Type = {
PyObject_HEAD_INIT(NULL)
@@ -4592,19 +4611,27 @@ PyTypeObject Control_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*/
CtlObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
CtlObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CtlObj_tp_init, /* tp_init */
+ CtlObj_tp_alloc, /* tp_alloc */
+ CtlObj_tp_new, /* tp_new */
+ CtlObj_tp_free, /* tp_free */
};
/* -------------------- End object type Control --------------------- */
@@ -6714,8 +6741,10 @@ void init_Ctl(void)
return;
Control_Type.ob_type = &PyType_Type;
Py_INCREF(&Control_Type);
- if (PyDict_SetItemString(d, "ControlType", (PyObject *)&Control_Type) != 0)
- Py_FatalError("can't initialize ControlType");
+ PyModule_AddObject(m, "Control", (PyObject *)&Control_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Control_Type);
+ PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type);
}
/* ======================== End module _Ctl ========================= */
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index 6053f93..2fa5757 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -490,7 +490,7 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
"""
-class MyObjectDefinition(PEP252Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("PyObject *ob_callbackdict;")
diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c
index c35d7a6..1a52c16 100644
--- a/Mac/Modules/dlg/_Dlgmodule.c
+++ b/Mac/Modules/dlg/_Dlgmodule.c
@@ -966,6 +966,7 @@ static PyMethodDef DlgObj_methods[] = {
#define DlgObj_getsetlist NULL
+
static int DlgObj_compare(DialogObject *self, DialogObject *other)
{
if ( self->ob_itself > other->ob_itself ) return 1;
@@ -979,6 +980,24 @@ static int DlgObj_hash(DialogObject *self)
{
return (int)self->ob_itself;
}
+#define DlgObj_tp_init 0
+
+#define DlgObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *DlgObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ DialogPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, DlgObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((DialogObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define DlgObj_tp_free PyObject_Del
+
PyTypeObject Dialog_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1001,19 +1020,27 @@ PyTypeObject Dialog_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*/
DlgObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
DlgObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ DlgObj_tp_init, /* tp_init */
+ DlgObj_tp_alloc, /* tp_alloc */
+ DlgObj_tp_new, /* tp_new */
+ DlgObj_tp_free, /* tp_free */
};
/* --------------------- End object type Dialog --------------------- */
@@ -1589,8 +1616,10 @@ void init_Dlg(void)
return;
Dialog_Type.ob_type = &PyType_Type;
Py_INCREF(&Dialog_Type);
- if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0)
- Py_FatalError("can't initialize DialogType");
+ PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Dialog_Type);
+ PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type);
}
/* ======================== End module _Dlg ========================= */
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index bf40a2c..a1a6753 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -201,7 +201,7 @@ initstuff = initstuff + """
# Define a class which specializes our object definition
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def __init__(self, name, prefix = None, itselftype = None):
GlobalObjectDefinition.__init__(self, name, prefix, itselftype)
## This won't work in Carbon, so we disable it for all MacPythons:-(
diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c
index b6354f4..e628b83 100644
--- a/Mac/Modules/drag/_Dragmodule.c
+++ b/Mac/Modules/drag/_Dragmodule.c
@@ -742,11 +742,30 @@ static PyMethodDef DragObj_methods[] = {
#define DragObj_getsetlist NULL
+
#define DragObj_compare NULL
#define DragObj_repr NULL
#define DragObj_hash NULL
+#define DragObj_tp_init 0
+
+#define DragObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *DragObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ DragRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, DragObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((DragObjObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define DragObj_tp_free PyObject_Del
+
PyTypeObject DragObj_Type = {
PyObject_HEAD_INIT(NULL)
@@ -769,19 +788,27 @@ PyTypeObject DragObj_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*/
DragObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
DragObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ DragObj_tp_init, /* tp_init */
+ DragObj_tp_alloc, /* tp_alloc */
+ DragObj_tp_new, /* tp_new */
+ DragObj_tp_free, /* tp_free */
};
/* -------------------- End object type DragObj --------------------- */
@@ -1109,8 +1136,10 @@ void init_Drag(void)
return;
DragObj_Type.ob_type = &PyType_Type;
Py_INCREF(&DragObj_Type);
- if (PyDict_SetItemString(d, "DragObjType", (PyObject *)&DragObj_Type) != 0)
- Py_FatalError("can't initialize DragObjType");
+ PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&DragObj_Type);
+ PyModule_AddObject(m, "DragObjType", (PyObject *)&DragObj_Type);
dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
index 3d2e76f..84c71a5 100644
--- a/Mac/Modules/drag/dragsupport.py
+++ b/Mac/Modules/drag/dragsupport.py
@@ -183,7 +183,7 @@ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
#endif
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Drag_Error,"Cannot create null Drag");
diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py
index b59fe22..8d2237e 100644
--- a/Mac/Modules/help/helpsupport.py
+++ b/Mac/Modules/help/helpsupport.py
@@ -46,7 +46,7 @@ includestuff = includestuff + """
#endif
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py
index f948c53..25406c7 100644
--- a/Mac/Modules/ibcarbon/IBCarbonsupport.py
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -31,11 +31,11 @@ initstuff = """
module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)
-class CFReleaserObject(PEP252Mixin, GlobalObjectDefinition):
+class CFReleaserObject(PEP253Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("CFRelease(%s);" % name)
-class CFNibDesc(PEP252Mixin, GlobalObjectDefinition):
+class CFNibDesc(PEP253Mixin, GlobalObjectDefinition):
def outputFreeIt(self, name):
Output("DisposeNibReference(%s);" % name)
diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c
index eb9b4c9..02c50fe 100644
--- a/Mac/Modules/ibcarbon/_IBCarbon.c
+++ b/Mac/Modules/ibcarbon/_IBCarbon.c
@@ -142,11 +142,30 @@ static PyMethodDef IBNibRefObj_methods[] = {
#define IBNibRefObj_getsetlist NULL
+
#define IBNibRefObj_compare NULL
#define IBNibRefObj_repr NULL
#define IBNibRefObj_hash NULL
+#define IBNibRefObj_tp_init 0
+
+#define IBNibRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *IBNibRefObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ IBNibRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, IBNibRefObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((IBNibRefObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define IBNibRefObj_tp_free PyObject_Del
+
PyTypeObject IBNibRef_Type = {
PyObject_HEAD_INIT(NULL)
@@ -169,19 +188,27 @@ PyTypeObject IBNibRef_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*/
IBNibRefObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
IBNibRefObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ IBNibRefObj_tp_init, /* tp_init */
+ IBNibRefObj_tp_alloc, /* tp_alloc */
+ IBNibRefObj_tp_new, /* tp_new */
+ IBNibRefObj_tp_free, /* tp_free */
};
/* -------------------- End object type IBNibRef -------------------- */
@@ -230,8 +257,10 @@ void init_IBCarbon(void)
return;
IBNibRef_Type.ob_type = &PyType_Type;
Py_INCREF(&IBNibRef_Type);
- if (PyDict_SetItemString(d, "IBNibRefType", (PyObject *)&IBNibRef_Type) != 0)
- Py_FatalError("can't initialize IBNibRefType");
+ PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&IBNibRef_Type);
+ PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type);
}
/* ====================== End module _IBCarbon ====================== */
diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py
index 5d71bab..6f72235 100644
--- a/Mac/Modules/icn/icnsupport.py
+++ b/Mac/Modules/icn/icnsupport.py
@@ -54,7 +54,7 @@ includestuff = includestuff + """
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c
index 559f543..6f89cbf 100644
--- a/Mac/Modules/list/_Listmodule.c
+++ b/Mac/Modules/list/_Listmodule.c
@@ -806,6 +806,24 @@ static PyGetSetDef ListObj_getsetlist[] = {
#define ListObj_repr NULL
#define ListObj_hash NULL
+#define ListObj_tp_init 0
+
+#define ListObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ ListHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ListObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ListObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define ListObj_tp_free PyObject_Del
+
PyTypeObject List_Type = {
PyObject_HEAD_INIT(NULL)
@@ -828,19 +846,27 @@ PyTypeObject List_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*/
ListObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
ListObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ ListObj_tp_init, /* tp_init */
+ ListObj_tp_alloc, /* tp_alloc */
+ ListObj_tp_new, /* tp_new */
+ ListObj_tp_free, /* tp_free */
};
/* ---------------------- End object type List ---------------------- */
@@ -1186,8 +1212,10 @@ void init_List(void)
return;
List_Type.ob_type = &PyType_Type;
Py_INCREF(&List_Type);
- if (PyDict_SetItemString(d, "ListType", (PyObject *)&List_Type) != 0)
- Py_FatalError("can't initialize ListType");
+ PyModule_AddObject(m, "List", (PyObject *)&List_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&List_Type);
+ PyModule_AddObject(m, "ListType", (PyObject *)&List_Type);
}
/* ======================== End module _List ======================== */
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index 87ed702..d1f2f10 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -137,7 +137,8 @@ class ListMethodGenerator(MethodGenerator):
FunctionGenerator.parseArgumentList(self, args)
self.argumentList.append(self.itself)
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Should inherit from Resource
getsetlist = [(
'listFlags',
'return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);',
diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c
index 517e08a..4f44c6f 100644
--- a/Mac/Modules/menu/_Menumodule.c
+++ b/Mac/Modules/menu/_Menumodule.c
@@ -3002,11 +3002,30 @@ static PyMethodDef MenuObj_methods[] = {
#define MenuObj_getsetlist NULL
+
#define MenuObj_compare NULL
#define MenuObj_repr NULL
#define MenuObj_hash NULL
+#define MenuObj_tp_init 0
+
+#define MenuObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ MenuHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MenuObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define MenuObj_tp_free PyObject_Del
+
PyTypeObject Menu_Type = {
PyObject_HEAD_INIT(NULL)
@@ -3029,19 +3048,27 @@ PyTypeObject Menu_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*/
MenuObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
MenuObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MenuObj_tp_init, /* tp_init */
+ MenuObj_tp_alloc, /* tp_alloc */
+ MenuObj_tp_new, /* tp_new */
+ MenuObj_tp_free, /* tp_free */
};
/* ---------------------- End object type Menu ---------------------- */
@@ -4127,8 +4154,10 @@ void init_Menu(void)
return;
Menu_Type.ob_type = &PyType_Type;
Py_INCREF(&Menu_Type);
- if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0)
- Py_FatalError("can't initialize MenuType");
+ PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Menu_Type);
+ PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
}
/* ======================== End module _Menu ======================== */
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index 1f21826..7a660c5 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -98,7 +98,7 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c
index 84b6130..83bbbf8 100644
--- a/Mac/Modules/mlte/_Mltemodule.c
+++ b/Mac/Modules/mlte/_Mltemodule.c
@@ -1297,11 +1297,30 @@ static PyMethodDef TXNObj_methods[] = {
#define TXNObj_getsetlist NULL
+
#define TXNObj_compare NULL
#define TXNObj_repr NULL
#define TXNObj_hash NULL
+#define TXNObj_tp_init 0
+
+#define TXNObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ TXNObject itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TXNObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TXNObjectObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define TXNObj_tp_free PyObject_Del
+
PyTypeObject TXNObject_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1324,19 +1343,27 @@ PyTypeObject TXNObject_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*/
TXNObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
TXNObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TXNObj_tp_init, /* tp_init */
+ TXNObj_tp_alloc, /* tp_alloc */
+ TXNObj_tp_new, /* tp_new */
+ TXNObj_tp_free, /* tp_free */
};
/* ------------------- End object type TXNObject -------------------- */
@@ -1423,11 +1450,30 @@ static PyMethodDef TXNFontMenuObj_methods[] = {
#define TXNFontMenuObj_getsetlist NULL
+
#define TXNFontMenuObj_compare NULL
#define TXNFontMenuObj_repr NULL
#define TXNFontMenuObj_hash NULL
+#define TXNFontMenuObj_tp_init 0
+
+#define TXNFontMenuObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ TXNFontMenuObject itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TXNFontMenuObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TXNFontMenuObjectObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define TXNFontMenuObj_tp_free PyObject_Del
+
PyTypeObject TXNFontMenuObject_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1450,19 +1496,27 @@ PyTypeObject TXNFontMenuObject_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*/
TXNFontMenuObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
TXNFontMenuObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TXNFontMenuObj_tp_init, /* tp_init */
+ TXNFontMenuObj_tp_alloc, /* tp_alloc */
+ TXNFontMenuObj_tp_new, /* tp_new */
+ TXNFontMenuObj_tp_free, /* tp_free */
};
/* --------------- End object type TXNFontMenuObject ---------------- */
@@ -1676,12 +1730,16 @@ void init_Mlte(void)
return;
TXNObject_Type.ob_type = &PyType_Type;
Py_INCREF(&TXNObject_Type);
- if (PyDict_SetItemString(d, "TXNObjectType", (PyObject *)&TXNObject_Type) != 0)
- Py_FatalError("can't initialize TXNObjectType");
+ 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_INCREF(&TXNFontMenuObject_Type);
- if (PyDict_SetItemString(d, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type) != 0)
- Py_FatalError("can't initialize TXNFontMenuObjectType");
+ PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TXNFontMenuObject_Type);
+ PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type);
}
/* ======================== End module _Mlte ======================== */
diff --git a/Mac/Modules/mlte/mltesupport.py b/Mac/Modules/mlte/mltesupport.py
index e9df43f..fe34fc7 100644
--- a/Mac/Modules/mlte/mltesupport.py
+++ b/Mac/Modules/mlte/mltesupport.py
@@ -136,11 +136,11 @@ execfile("mltetypetest.py")
# Our (opaque) objects
-class TXNObjDefinition(PEP252Mixin, GlobalObjectDefinition):
+class TXNObjDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
-class TXNFontMenuObjDefinition(PEP252Mixin, GlobalObjectDefinition):
+class TXNFontMenuObjDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c
index 7ee2e98..a1be346 100644
--- a/Mac/Modules/qd/_Qdmodule.c
+++ b/Mac/Modules/qd/_Qdmodule.c
@@ -1115,6 +1115,24 @@ static PyGetSetDef GrafObj_getsetlist[] = {
#define GrafObj_repr NULL
#define GrafObj_hash NULL
+#define GrafObj_tp_init 0
+
+#define GrafObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ GrafPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, GrafObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((GrafPortObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define GrafObj_tp_free PyObject_Del
+
PyTypeObject GrafPort_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1137,19 +1155,27 @@ PyTypeObject GrafPort_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*/
GrafObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
GrafObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ GrafObj_tp_init, /* tp_init */
+ GrafObj_tp_alloc, /* tp_alloc */
+ GrafObj_tp_new, /* tp_new */
+ GrafObj_tp_free, /* tp_free */
};
/* -------------------- End object type GrafPort -------------------- */
@@ -1287,6 +1313,24 @@ static PyGetSetDef BMObj_getsetlist[] = {
#define BMObj_repr NULL
#define BMObj_hash NULL
+#define BMObj_tp_init 0
+
+#define BMObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ BitMapPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, BMObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((BitMapObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define BMObj_tp_free PyObject_Del
+
PyTypeObject BitMap_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1309,19 +1353,27 @@ PyTypeObject BitMap_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*/
BMObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
BMObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ BMObj_tp_init, /* tp_init */
+ BMObj_tp_alloc, /* tp_alloc */
+ BMObj_tp_new, /* tp_new */
+ BMObj_tp_free, /* tp_free */
};
/* --------------------- End object type BitMap --------------------- */
@@ -6872,12 +6924,16 @@ void init_Qd(void)
return;
GrafPort_Type.ob_type = &PyType_Type;
Py_INCREF(&GrafPort_Type);
- if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
- Py_FatalError("can't initialize GrafPortType");
+ 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_INCREF(&BitMap_Type);
- if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
- Py_FatalError("can't initialize BitMapType");
+ PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&BitMap_Type);
+ PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type);
}
/* ========================= End module _Qd ========================= */
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index c668e95..16a99d5 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -236,7 +236,7 @@ initstuff = initstuff + """
## def outputFreeIt(self, itselfname):
## Output("KillPoly(%s);", itselfname)
-class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyGRObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [
('visRgn',
"""RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
@@ -277,7 +277,7 @@ class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
OutRbrace()
Output("#endif")
-class MyBMObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyBMObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
getsetlist = [
(
'baseAddr',
diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c
index 9804b71..3f5dd04 100644
--- a/Mac/Modules/qdoffs/_Qdoffsmodule.c
+++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c
@@ -133,11 +133,30 @@ static PyMethodDef GWorldObj_methods[] = {
#define GWorldObj_getsetlist NULL
+
#define GWorldObj_compare NULL
#define GWorldObj_repr NULL
#define GWorldObj_hash NULL
+#define GWorldObj_tp_init 0
+
+#define GWorldObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *GWorldObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ GWorldPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, GWorldObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((GWorldObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define GWorldObj_tp_free PyObject_Del
+
PyTypeObject GWorld_Type = {
PyObject_HEAD_INIT(NULL)
@@ -160,19 +179,27 @@ PyTypeObject GWorld_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*/
GWorldObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
GWorldObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ GWorldObj_tp_init, /* tp_init */
+ GWorldObj_tp_alloc, /* tp_alloc */
+ GWorldObj_tp_new, /* tp_new */
+ GWorldObj_tp_free, /* tp_free */
};
/* --------------------- End object type GWorld --------------------- */
@@ -684,8 +711,10 @@ void init_Qdoffs(void)
return;
GWorld_Type.ob_type = &PyType_Type;
Py_INCREF(&GWorld_Type);
- if (PyDict_SetItemString(d, "GWorldType", (PyObject *)&GWorld_Type) != 0)
- Py_FatalError("can't initialize GWorldType");
+ PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&GWorld_Type);
+ PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type);
}
/* ======================= End module _Qdoffs ======================= */
diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py
index 11ce8fd..0c4dd2a 100644
--- a/Mac/Modules/qdoffs/qdoffssupport.py
+++ b/Mac/Modules/qdoffs/qdoffssupport.py
@@ -57,7 +57,8 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Should inherit from GrafPtr?
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
## def outputInitStructMembers(self):
diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c
index 47ec3d9..8e0783c 100644
--- a/Mac/Modules/qt/_Qtmodule.c
+++ b/Mac/Modules/qt/_Qtmodule.c
@@ -1092,11 +1092,30 @@ static PyMethodDef MovieCtlObj_methods[] = {
#define MovieCtlObj_getsetlist NULL
+
#define MovieCtlObj_compare NULL
#define MovieCtlObj_repr NULL
#define MovieCtlObj_hash NULL
+#define MovieCtlObj_tp_init 0
+
+#define MovieCtlObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MovieCtlObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ MovieController itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MovieCtlObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MovieControllerObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define MovieCtlObj_tp_free PyObject_Del
+
PyTypeObject MovieController_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1119,19 +1138,27 @@ PyTypeObject MovieController_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*/
MovieCtlObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
MovieCtlObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MovieCtlObj_tp_init, /* tp_init */
+ MovieCtlObj_tp_alloc, /* tp_alloc */
+ MovieCtlObj_tp_new, /* tp_new */
+ MovieCtlObj_tp_free, /* tp_free */
};
/* ---------------- End object type MovieController ----------------- */
@@ -1553,11 +1580,30 @@ static PyMethodDef TimeBaseObj_methods[] = {
#define TimeBaseObj_getsetlist NULL
+
#define TimeBaseObj_compare NULL
#define TimeBaseObj_repr NULL
#define TimeBaseObj_hash NULL
+#define TimeBaseObj_tp_init 0
+
+#define TimeBaseObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TimeBaseObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ TimeBase itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TimeBaseObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TimeBaseObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define TimeBaseObj_tp_free PyObject_Del
+
PyTypeObject TimeBase_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1580,19 +1626,27 @@ PyTypeObject TimeBase_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*/
TimeBaseObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
TimeBaseObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TimeBaseObj_tp_init, /* tp_init */
+ TimeBaseObj_tp_alloc, /* tp_alloc */
+ TimeBaseObj_tp_new, /* tp_new */
+ TimeBaseObj_tp_free, /* tp_free */
};
/* -------------------- End object type TimeBase -------------------- */
@@ -1867,11 +1921,30 @@ static PyMethodDef UserDataObj_methods[] = {
#define UserDataObj_getsetlist NULL
+
#define UserDataObj_compare NULL
#define UserDataObj_repr NULL
#define UserDataObj_hash NULL
+#define UserDataObj_tp_init 0
+
+#define UserDataObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *UserDataObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ UserData itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, UserDataObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((UserDataObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define UserDataObj_tp_free PyObject_Del
+
PyTypeObject UserData_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1894,19 +1967,27 @@ PyTypeObject UserData_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*/
UserDataObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
UserDataObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ UserDataObj_tp_init, /* tp_init */
+ UserDataObj_tp_alloc, /* tp_alloc */
+ UserDataObj_tp_new, /* tp_new */
+ UserDataObj_tp_free, /* tp_free */
};
/* -------------------- End object type UserData -------------------- */
@@ -3052,11 +3133,30 @@ static PyMethodDef MediaObj_methods[] = {
#define MediaObj_getsetlist NULL
+
#define MediaObj_compare NULL
#define MediaObj_repr NULL
#define MediaObj_hash NULL
+#define MediaObj_tp_init 0
+
+#define MediaObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MediaObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ Media itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MediaObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MediaObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define MediaObj_tp_free PyObject_Del
+
PyTypeObject Media_Type = {
PyObject_HEAD_INIT(NULL)
@@ -3079,19 +3179,27 @@ PyTypeObject Media_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*/
MediaObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
MediaObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MediaObj_tp_init, /* tp_init */
+ MediaObj_tp_alloc, /* tp_alloc */
+ MediaObj_tp_new, /* tp_new */
+ MediaObj_tp_free, /* tp_free */
};
/* --------------------- End object type Media ---------------------- */
@@ -4343,11 +4451,30 @@ static PyMethodDef TrackObj_methods[] = {
#define TrackObj_getsetlist NULL
+
#define TrackObj_compare NULL
#define TrackObj_repr NULL
#define TrackObj_hash NULL
+#define TrackObj_tp_init 0
+
+#define TrackObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TrackObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ Track itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TrackObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TrackObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define TrackObj_tp_free PyObject_Del
+
PyTypeObject Track_Type = {
PyObject_HEAD_INIT(NULL)
@@ -4370,19 +4497,27 @@ PyTypeObject Track_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*/
TrackObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
TrackObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TrackObj_tp_init, /* tp_init */
+ TrackObj_tp_alloc, /* tp_alloc */
+ TrackObj_tp_new, /* tp_new */
+ TrackObj_tp_free, /* tp_free */
};
/* --------------------- End object type Track ---------------------- */
@@ -6774,11 +6909,30 @@ static PyMethodDef MovieObj_methods[] = {
#define MovieObj_getsetlist NULL
+
#define MovieObj_compare NULL
#define MovieObj_repr NULL
#define MovieObj_hash NULL
+#define MovieObj_tp_init 0
+
+#define MovieObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MovieObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ Movie itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MovieObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MovieObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define MovieObj_tp_free PyObject_Del
+
PyTypeObject Movie_Type = {
PyObject_HEAD_INIT(NULL)
@@ -6801,19 +6955,27 @@ PyTypeObject Movie_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*/
MovieObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
MovieObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MovieObj_tp_init, /* tp_init */
+ MovieObj_tp_alloc, /* tp_alloc */
+ MovieObj_tp_new, /* tp_new */
+ MovieObj_tp_free, /* tp_free */
};
/* --------------------- End object type Movie ---------------------- */
@@ -9966,28 +10128,40 @@ void init_Qt(void)
return;
MovieController_Type.ob_type = &PyType_Type;
Py_INCREF(&MovieController_Type);
- if (PyDict_SetItemString(d, "MovieControllerType", (PyObject *)&MovieController_Type) != 0)
- Py_FatalError("can't initialize MovieControllerType");
+ 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_INCREF(&TimeBase_Type);
- if (PyDict_SetItemString(d, "TimeBaseType", (PyObject *)&TimeBase_Type) != 0)
- Py_FatalError("can't initialize TimeBaseType");
+ 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_INCREF(&UserData_Type);
- if (PyDict_SetItemString(d, "UserDataType", (PyObject *)&UserData_Type) != 0)
- Py_FatalError("can't initialize UserDataType");
+ 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_INCREF(&Media_Type);
- if (PyDict_SetItemString(d, "MediaType", (PyObject *)&Media_Type) != 0)
- Py_FatalError("can't initialize MediaType");
+ 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_INCREF(&Track_Type);
- if (PyDict_SetItemString(d, "TrackType", (PyObject *)&Track_Type) != 0)
- Py_FatalError("can't initialize TrackType");
+ 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_INCREF(&Movie_Type);
- if (PyDict_SetItemString(d, "MovieType", (PyObject *)&Movie_Type) != 0)
- Py_FatalError("can't initialize MovieType");
+ PyModule_AddObject(m, "Movie", (PyObject *)&Movie_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Movie_Type);
+ PyModule_AddObject(m, "MovieType", (PyObject *)&Movie_Type);
}
/* ========================= End module _Qt ========================= */
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 8160a30..c4e1653 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -181,7 +181,7 @@ QTFloatSingle = Type("QTFloatSingle", "f")
dummyshortptr = FakeType('(short *)0')
dummyStringPtr = FakeType('(StringPtr)0')
-class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MovieObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Movie");
@@ -190,7 +190,7 @@ class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovie(%s);", itselfname)
-class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class TrackObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Track");
@@ -199,7 +199,7 @@ class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeMovieTrack(%s);", itselfname)
-class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MediaObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null Media");
@@ -208,7 +208,7 @@ class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeTrackMedia(%s);", itselfname)
-class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class UserDataObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null UserData");
@@ -217,7 +217,7 @@ class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("DisposeUserData(%s);", itselfname)
-class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class TimeBaseObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null TimeBase");
@@ -226,7 +226,7 @@ class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
## def outputFreeIt(self, itselfname):
## Output("DisposeTimeBase(%s);", itselfname)
-class MovieCtlObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MovieCtlObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(Qt_Error,"Cannot create null MovieController");
diff --git a/Mac/Modules/scrap/scrapsupport.py b/Mac/Modules/scrap/scrapsupport.py
index 43fcb46..b89b405 100644
--- a/Mac/Modules/scrap/scrapsupport.py
+++ b/Mac/Modules/scrap/scrapsupport.py
@@ -55,7 +55,7 @@ ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l')
#ScrapFlavorInfo = OpaqueType('ScrapFlavorInfo', 'ScrapFlavorInfo')
putscrapbuffer = FixedInputBufferType('void *')
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass
# Create the generator groups and link them
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c
index 412ae9d..5f8c172 100644
--- a/Mac/Modules/snd/_Sndmodule.c
+++ b/Mac/Modules/snd/_Sndmodule.c
@@ -330,19 +330,27 @@ static PyTypeObject SndChannel_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, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
SndCh_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
SndCh_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
};
/* ------------------- End object type SndChannel ------------------- */
@@ -459,6 +467,7 @@ static PyGetSetDef SPBObj_getsetlist[] = {
{"milliseconds", (getter)SPBObj_get_milliseconds, (setter)SPBObj_set_milliseconds, NULL},
{"error", (getter)SPBObj_get_error, (setter)SPBObj_set_error, NULL},
{"completionRoutine", (getter)SPBObj_get_completionRoutine, (setter)SPBObj_set_completionRoutine, NULL},
+ {NULL, NULL, NULL, NULL},
};
@@ -489,19 +498,27 @@ static PyTypeObject SPB_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, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
SPBObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
SPBObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
};
/* ---------------------- End object type SPB ----------------------- */
@@ -1537,12 +1554,16 @@ void init_Snd(void)
return;
SndChannel_Type.ob_type = &PyType_Type;
Py_INCREF(&SndChannel_Type);
- if (PyDict_SetItemString(d, "SndChannelType", (PyObject *)&SndChannel_Type) != 0)
- Py_FatalError("can't initialize SndChannelType");
+ 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_INCREF(&SPB_Type);
- if (PyDict_SetItemString(d, "SPBType", (PyObject *)&SPB_Type) != 0)
- Py_FatalError("can't initialize SPBType");
+ PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&SPB_Type);
+ PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type);
}
/* ======================== End module _Snd ========================= */
diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c
index a89826b..03031d2 100644
--- a/Mac/Modules/te/_TEmodule.c
+++ b/Mac/Modules/te/_TEmodule.c
@@ -979,6 +979,7 @@ static PyGetSetDef TEObj_getsetlist[] = {
{"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"},
{"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"},
{"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"},
+ {NULL, NULL, NULL, NULL},
};
@@ -987,6 +988,24 @@ static PyGetSetDef TEObj_getsetlist[] = {
#define TEObj_repr NULL
#define TEObj_hash NULL
+#define TEObj_tp_init 0
+
+#define TEObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ TEHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, TEObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TEObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define TEObj_tp_free PyObject_Del
+
PyTypeObject TE_Type = {
PyObject_HEAD_INIT(NULL)
@@ -1009,19 +1028,27 @@ PyTypeObject TE_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*/
TEObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
TEObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TEObj_tp_init, /* tp_init */
+ TEObj_tp_alloc, /* tp_alloc */
+ TEObj_tp_new, /* tp_new */
+ TEObj_tp_free, /* tp_free */
};
/* ----------------------- End object type TE ----------------------- */
@@ -1313,8 +1340,10 @@ void init_TE(void)
return;
TE_Type.ob_type = &PyType_Type;
Py_INCREF(&TE_Type);
- if (PyDict_SetItemString(d, "TEType", (PyObject *)&TE_Type) != 0)
- Py_FatalError("can't initialize TEType");
+ PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TE_Type);
+ PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
}
/* ========================= End module _TE ========================= */
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index f11e718..cac020b 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -93,7 +93,8 @@ class TEMethodGenerator(OSErrWeakLinkMethodGenerator):
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Could be subtype of Resource
# Attributes that can be set.
getsetlist = [
(
diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c
index 93f8aa5..aa31e30 100644
--- a/Mac/Modules/waste/wastemodule.c
+++ b/Mac/Modules/waste/wastemodule.c
@@ -386,11 +386,30 @@ static PyMethodDef WEOObj_methods[] = {
#define WEOObj_getsetlist NULL
+
#define WEOObj_compare NULL
#define WEOObj_repr NULL
#define WEOObj_hash NULL
+#define WEOObj_tp_init 0
+
+#define WEOObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ WEObjectReference itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((WEOObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define WEOObj_tp_free PyObject_Del
+
PyTypeObject WEO_Type = {
PyObject_HEAD_INIT(NULL)
@@ -413,19 +432,27 @@ PyTypeObject WEO_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*/
WEOObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
WEOObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ WEOObj_tp_init, /* tp_init */
+ WEOObj_tp_alloc, /* tp_alloc */
+ WEOObj_tp_new, /* tp_new */
+ WEOObj_tp_free, /* tp_free */
};
/* ---------------------- End object type WEO ----------------------- */
@@ -2108,11 +2135,30 @@ static PyMethodDef wasteObj_methods[] = {
#define wasteObj_getsetlist NULL
+
#define wasteObj_compare NULL
#define wasteObj_repr NULL
#define wasteObj_hash NULL
+#define wasteObj_tp_init 0
+
+#define wasteObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ WEReference itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((wasteObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define wasteObj_tp_free PyObject_Del
+
PyTypeObject waste_Type = {
PyObject_HEAD_INIT(NULL)
@@ -2135,19 +2181,27 @@ PyTypeObject waste_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*/
wasteObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
wasteObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ wasteObj_tp_init, /* tp_init */
+ wasteObj_tp_alloc, /* tp_alloc */
+ wasteObj_tp_new, /* tp_new */
+ wasteObj_tp_free, /* tp_free */
};
/* --------------------- End object type waste ---------------------- */
@@ -2506,12 +2560,16 @@ void initwaste(void)
return;
WEO_Type.ob_type = &PyType_Type;
Py_INCREF(&WEO_Type);
- if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
- Py_FatalError("can't initialize WEOType");
+ 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;
Py_INCREF(&waste_Type);
- if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
- Py_FatalError("can't initialize wasteType");
+ PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&waste_Type);
+ PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
callbackdict = PyDict_New();
if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
diff --git a/Mac/Modules/waste/wastesupport.py b/Mac/Modules/waste/wastesupport.py
index b9c1bfb..fc891ef 100644
--- a/Mac/Modules/waste/wastesupport.py
+++ b/Mac/Modules/waste/wastesupport.py
@@ -277,7 +277,7 @@ class WEMethodGenerator(OSErrMethodGenerator):
-class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class WEObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
PyErr_SetString(waste_Error,"Cannot create null WE");
@@ -289,7 +289,7 @@ class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputFreeIt(self, itselfname):
Output("WEDispose(%s);", itselfname)
-class WEOObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class WEOObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
Py_INCREF(Py_None);
diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c
index 60ff824..6629cfa 100644
--- a/Mac/Modules/win/_Winmodule.c
+++ b/Mac/Modules/win/_Winmodule.c
@@ -77,6 +77,7 @@ PyObject *WinObj_New(WindowPtr itself)
{
WindowObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
+ /* XXXX Or should we use WhichWindow code here? */
it = PyObject_NEW(WindowObject, &Window_Type);
if (it == NULL) return NULL;
it->ob_itself = itself;
@@ -2928,6 +2929,7 @@ static PyMethodDef WinObj_methods[] = {
#define WinObj_getsetlist NULL
+
static int WinObj_compare(WindowObject *self, WindowObject *other)
{
if ( self->ob_itself > other->ob_itself ) return 1;
@@ -2946,6 +2948,24 @@ static int WinObj_hash(WindowObject *self)
{
return (int)self->ob_itself;
}
+#define WinObj_tp_init 0
+
+#define WinObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *WinObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *self;
+ WindowPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WinObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((WindowObject *)self)->ob_itself = itself;
+ return self;
+}
+
+#define WinObj_tp_free PyObject_Del
+
PyTypeObject Window_Type = {
PyObject_HEAD_INIT(NULL)
@@ -2968,19 +2988,27 @@ PyTypeObject Window_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*/
WinObj_methods, /* tp_methods */
- 0, /*outputHook_tp_members*/
+ 0, /*tp_members*/
WinObj_getsetlist, /*tp_getset*/
- 0, /*outputHook_tp_base*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ WinObj_tp_init, /* tp_init */
+ WinObj_tp_alloc, /* tp_alloc */
+ WinObj_tp_new, /* tp_new */
+ WinObj_tp_free, /* tp_free */
};
/* --------------------- End object type Window --------------------- */
@@ -3828,8 +3856,10 @@ void init_Win(void)
return;
Window_Type.ob_type = &PyType_Type;
Py_INCREF(&Window_Type);
- if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0)
- Py_FatalError("can't initialize WindowType");
+ PyModule_AddObject(m, "Window", (PyObject *)&Window_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Window_Type);
+ PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type);
}
/* ======================== End module _Win ========================= */
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index ba7fe14..5d041d6 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -128,9 +128,10 @@ initstuff = initstuff + """
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
"""
-class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ Output("/* XXXX Or should we use WhichWindow code here? */")
def outputStructMembers(self):
GlobalObjectDefinition.outputStructMembers(self)
Output("void (*ob_freeit)(%s ptr);", self.itselftype)