diff options
author | Barry Warsaw <barry@python.org> | 2011-12-15 06:57:21 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2011-12-15 06:57:21 -0500 |
commit | 4c1c2eade1c5b383adad94a7a4fd6553873fecf0 (patch) | |
tree | b9e0f45fc19539bcaddff69e661bf0c5d21bab5a /test/dbus_py_test.c | |
parent | 667082d0b4aef9c438a2e7fec89614b5b8ef960a (diff) | |
download | dbus-python-4c1c2eade1c5b383adad94a7a4fd6553873fecf0.tar.gz |
This is the big one; it adds Python 3 support.
Diffstat (limited to 'test/dbus_py_test.c')
-rw-r--r-- | test/dbus_py_test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/dbus_py_test.c b/test/dbus_py_test.c index a98c4d7..ea892ab 100644 --- a/test/dbus_py_test.c +++ b/test/dbus_py_test.c @@ -26,7 +26,11 @@ #include <Python.h> #include "dbus-python.h" +#ifdef PY3 +PyMODINIT_FUNC PyInit_dbus_py_test(void); +#else PyMODINIT_FUNC initdbus_py_test(void); +#endif #if defined(__GNUC__) # if __GNUC__ >= 3 @@ -113,6 +117,27 @@ static PyMethodDef module_functions[] = { {NULL, NULL, 0, NULL} }; +#ifdef PY3 +PyMODINIT_FUNC +PyInit_dbus_py_test(void) +{ + static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "dbus_py_test", /* m_name */ + NULL, /* m_doc */ + -1, /* m_size */ + module_functions, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + }; + if (import_dbus_bindings("dbus_py_test") < 0) + return NULL; + + return PyModule_Create(&moduledef); +} +#else PyMODINIT_FUNC initdbus_py_test(void) { @@ -122,5 +147,6 @@ initdbus_py_test(void) this_module = Py_InitModule3 ("dbus_py_test", module_functions, ""); if (!this_module) return; } +#endif /* vim:set ft=c cino< sw=4 sts=4 et: */ |