On Thu, 15 Oct 2009, David Malcolm wrote:

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);

I fixed this a bit differently by using Py_BuildValue("s", shortname) instead to let python decide what sort of object it wants to create: Python 3 creates unicode and older ones create string objects.

        - Panu -
_______________________________________________
Rpm-maint mailing list
[email protected]
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to