summaryrefslogtreecommitdiff
path: root/_dbus_bindings/string.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-12-15 06:57:21 -0500
committerBarry Warsaw <barry@python.org>2011-12-15 06:57:21 -0500
commit4c1c2eade1c5b383adad94a7a4fd6553873fecf0 (patch)
treeb9e0f45fc19539bcaddff69e661bf0c5d21bab5a /_dbus_bindings/string.c
parent667082d0b4aef9c438a2e7fec89614b5b8ef960a (diff)
downloaddbus-python-4c1c2eade1c5b383adad94a7a4fd6553873fecf0.tar.gz
This is the big one; it adds Python 3 support.
Diffstat (limited to '_dbus_bindings/string.c')
-rw-r--r--_dbus_bindings/string.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/_dbus_bindings/string.c b/_dbus_bindings/string.c
index 33bb3af..8f426b2 100644
--- a/_dbus_bindings/string.c
+++ b/_dbus_bindings/string.c
@@ -26,6 +26,7 @@
#include "types-internal.h"
#include <structmember.h>
+#ifndef PY3
/* UTF-8 string representation ====================================== */
PyDoc_STRVAR(UTF8String_tp_doc,
@@ -121,6 +122,7 @@ PyTypeObject DBusPyUTF8String_Type = {
0, /* tp_alloc */
UTF8String_tp_new, /* tp_new */
};
+#endif /* !PY3 */
/* Object path ====================================================== */
@@ -343,18 +345,16 @@ dbus_py_init_string_types(void)
if (PyType_Ready(&DBusPyString_Type) < 0) return 0;
DBusPyString_Type.tp_print = NULL;
+#ifndef PY3
DBusPyUTF8String_Type.tp_base = &DBusPyStrBase_Type;
if (PyType_Ready(&DBusPyUTF8String_Type) < 0) return 0;
DBusPyUTF8String_Type.tp_print = NULL;
+#endif
DBusPyObjectPath_Type.tp_base = &DBusPyStrBase_Type;
if (PyType_Ready(&DBusPyObjectPath_Type) < 0) return 0;
DBusPyObjectPath_Type.tp_print = NULL;
- DBusPyBoolean_Type.tp_base = &DBusPyIntBase_Type;
- if (PyType_Ready(&DBusPyBoolean_Type) < 0) return 0;
- DBusPyBoolean_Type.tp_print = NULL;
-
return 1;
}
@@ -363,15 +363,18 @@ dbus_py_insert_string_types(PyObject *this_module)
{
/* PyModule_AddObject steals a ref */
Py_INCREF(&DBusPyObjectPath_Type);
- Py_INCREF(&DBusPyUTF8String_Type);
Py_INCREF(&DBusPyString_Type);
if (PyModule_AddObject(this_module, "ObjectPath",
(PyObject *)&DBusPyObjectPath_Type) < 0) return 0;
- if (PyModule_AddObject(this_module, "UTF8String",
- (PyObject *)&DBusPyUTF8String_Type) < 0) return 0;
if (PyModule_AddObject(this_module, "String",
(PyObject *)&DBusPyString_Type) < 0) return 0;
+#ifndef PY3
+ Py_INCREF(&DBusPyUTF8String_Type);
+ if (PyModule_AddObject(this_module, "UTF8String",
+ (PyObject *)&DBusPyUTF8String_Type) < 0) return 0;
+#endif
+
return 1;
}