From 3b069a1dca0c8bd147ec1e2ea7a544e9f75d6032 Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Fri, 12 Jul 2002 13:50:57 +0000 Subject: These changes help with win32 compat. 2002-07-12 James Henstridge These changes help with win32 compat. * pygboxed.c (PyGBoxed_Type): set tp_alloc and tp_new to NULL. (PyGPointer_Type): same here. * gobjectmodule.c (PyGInterface_Type): set tp_alloc and tp_new to NULL. (initgobject): set tp_new and tp_alloc for various types. * pygobject.c (PyGObject_Type): set tp_alloc and tp_new to NULL. --- gobject/gobjectmodule.c | 12 ++++++++++-- gobject/pygboxed.c | 8 ++++---- gobject/pygobject.c | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 33f82f0..de1d4bb 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -224,8 +224,8 @@ static PyTypeObject PyGInterface_Type = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pyg_interface_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ object_free, /* tp_free */ (inquiry)0, /* tp_is_gc */ (PyObject *)0, /* tp_bases */ @@ -1353,12 +1353,16 @@ initgobject(void) gerror_exc = PyErr_NewException("gobject.GError", PyExc_RuntimeError,NULL); PyDict_SetItemString(d, "GError", gerror_exc); + PyGObject_Type.tp_alloc = PyType_GenericAlloc; + PyGObject_Type.tp_new = PyType_GenericNew; pygobject_register_class(d, "GObject", G_TYPE_OBJECT, &PyGObject_Type, NULL); PyDict_SetItemString(PyGObject_Type.tp_dict, "__gdoc__", pyg_object_descr_doc_get()); PyGInterface_Type.ob_type = &PyType_Type; + PyGInterface_Type.tp_alloc = PyType_GenericAlloc; + PyGInterface_Type.tp_new = PyType_GenericNew; if (PyType_Ready(&PyGInterface_Type)) return; PyDict_SetItemString(d, "GInterface", (PyObject *)&PyGInterface_Type); @@ -1371,6 +1375,8 @@ initgobject(void) pyg_object_descr_doc_get()); PyGBoxed_Type.ob_type = &PyType_Type; + PyGBoxed_Type.tp_alloc = PyType_GenericAlloc; + PyGBoxed_Type.tp_new = PyType_GenericNew; if (PyType_Ready(&PyGBoxed_Type)) return; PyDict_SetItemString(d, "GBoxed", (PyObject *)&PyGBoxed_Type); @@ -1379,6 +1385,8 @@ initgobject(void) Py_DECREF(o); PyGPointer_Type.ob_type = &PyType_Type; + PyGPointer_Type.tp_alloc = PyType_GenericAlloc; + PyGPointer_Type.tp_new = PyType_GenericNew; if (PyType_Ready(&PyGPointer_Type)) return; PyDict_SetItemString(d, "GPointer", (PyObject *)&PyGPointer_Type); diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c index a8f4a25..6007c61 100644 --- a/gobject/pygboxed.c +++ b/gobject/pygboxed.c @@ -115,8 +115,8 @@ PyTypeObject PyGBoxed_Type = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pyg_boxed_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ pyg_boxed_free, /* tp_free */ (inquiry)0, /* tp_is_gc */ (PyObject *)0, /* tp_bases */ @@ -281,8 +281,8 @@ PyTypeObject PyGPointer_Type = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pyg_pointer_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ pyg_pointer_free, /* tp_free */ (inquiry)0, /* tp_is_gc */ (PyObject *)0, /* tp_bases */ diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 30aeb38..d550127 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -974,8 +974,8 @@ PyTypeObject PyGObject_Type = { 0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ (initproc)pygobject_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ pygobject_free, /* tp_free */ (inquiry)0, /* tp_is_gc */ (PyObject *)0, /* tp_bases */ -- cgit