diff options
author | John Ehresman <jpe@wingware.com> | 2010-04-14 16:12:22 -0400 |
---|---|---|
committer | John Ehresman <jpe@wingware.com> | 2010-04-15 12:18:00 -0400 |
commit | 4572baf15f87cc0ef21d731fc7ba0ecf0de2f463 (patch) | |
tree | 7d345fac8090155fafb1ddc1fb0d99876665b3ce /tests | |
parent | b28ac0322bf7b1316b5ed8b19492a3848b090ab0 (diff) | |
download | pygobject-4572baf15f87cc0ef21d731fc7ba0ecf0de2f463.tar.gz pygobject-4572baf15f87cc0ef21d731fc7ba0ecf0de2f463.tar.xz pygobject-4572baf15f87cc0ef21d731fc7ba0ecf0de2f463.zip |
Changes to module init, and to compile under python3. Doesn't work though
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common.py | 4 | ||||
-rw-r--r-- | tests/testhelpermodule.c | 26 |
2 files changed, 14 insertions, 16 deletions
diff --git a/tests/common.py b/tests/common.py index a6fa73d..ff30ec1 100644 --- a/tests/common.py +++ b/tests/common.py @@ -34,7 +34,9 @@ def importModule(module, directory, name=None): try: obj = __import__(module, {}, {}, '') - except ImportError, e: + except ImportError: + raise + e = sys.exc_info()[1] raise SystemExit('%s could not be imported: %s' % (origName, e)) location = obj.__file__ diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index dc8c609..c6fd9f5 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -112,8 +112,7 @@ static const PyMethodDef _PyTestInterface_methods[] = { /* TestInterface */ PyTypeObject PyTestInterface_Type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "test.Interface", /* tp_name */ sizeof(PyObject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -122,7 +121,7 @@ PyTypeObject PyTestInterface_Type = { (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ + NULL, /* tp_compare */ (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ @@ -183,8 +182,7 @@ _wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, PyObject *kw } PyTypeObject PyTestUnknown_Type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "testhelper.Unknown", /* tp_name */ sizeof(PyGObject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -193,7 +191,7 @@ PyTypeObject PyTestUnknown_Type = { (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ + NULL, /* tp_compare */ (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ @@ -524,31 +522,28 @@ static PyMethodDef testhelper_functions[] = { { NULL, NULL } }; -void -inittesthelper () +PYGLIB_INIT_FUNCTION(testhelper, "testhelper", testhelper_functions) { PyObject *m, *d; - PyObject *module; g_thread_init(NULL); init_pygobject(); - m = Py_InitModule ("testhelper", testhelper_functions); - d = PyModule_GetDict(m); + d = PyModule_GetDict(module); - if ((module = PyImport_ImportModule("gobject")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); + if ((m = PyImport_ImportModule("gobject")) != NULL) { + PyObject *moddict = PyModule_GetDict(m); _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); if (_PyGObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name GObject from gobject"); - return ; + return -1; } } else { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return ; + return -1; } /* TestInterface */ @@ -566,5 +561,6 @@ inittesthelper () pyg_set_object_has_new_constructor(TEST_TYPE_UNKNOWN); //pyg_register_class_init(TEST_TYPE_UNKNOWN, __GtkUIManager_class_init); + return 0; } |