[Rpm-maint] [PATCH 12/15] Use PyUnicode_ on Python 3 when setting up the various RPMTAG_ constants
David Malcolm
dmalcolm at redhat.com
Thu Oct 15 19:15:06 UTC 2009
Python 3 doesn't have a PyString_ anymore; use PyUnicode_ instead.
---
python/rpmmodule.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 6a3f98a..e0aeddc 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -191,7 +191,11 @@ static void addRpmTags(PyObject *module)
PyModule_AddIntConstant(module, tagname, tagval);
pyval = PyInt_FromLong(tagval);
+#if PY_MAJOR_VERSION >= 3
+ pyname = PyUnicode_FromString(shortname);
+#else
pyname = PyString_FromString(shortname);
+#endif
PyDict_SetItem(dict, pyval, pyname);
Py_DECREF(pyval);
Py_DECREF(pyname);
--
1.6.2.5
More information about the Rpm-maint
mailing list