summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-23 21:25:08 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-23 21:25:08 +0300
commitd728e466d2055432b874b4777b3ca07ef3260518 (patch)
tree716f874db935fbb535efba4aa2a1253832b096b1 /python
parente13a476fc94509cb6f3d159e6135b48fdafcdf78 (diff)
downloadrpm-d728e466d2055432b874b4777b3ca07ef3260518.tar.gz
rpm-d728e466d2055432b874b4777b3ca07ef3260518.tar.bz2
rpm-d728e466d2055432b874b4777b3ca07ef3260518.zip
Allow unicode objects as tag name everywhere
Diffstat (limited to 'python')
-rw-r--r--python/header-py.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/header-py.c b/python/header-py.c
index dc26d8e4e..6f82dc7c7 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -433,12 +433,14 @@ int utf8FromPyObject(PyObject *item, PyObject **str)
int tagNumFromPyObject (PyObject *item, rpmTag *tagp)
{
rpmTag tag = RPMTAG_NOT_FOUND;
+ PyObject *str = NULL;
if (PyInt_Check(item)) {
/* XXX we should probably validate tag numbers too */
tag = PyInt_AsLong(item);
- } else if (PyBytes_Check(item)) {
- tag = rpmTagGetValue(PyBytes_AsString(item));
+ } else if (utf8FromPyObject(item, &str)) {
+ tag = rpmTagGetValue(PyBytes_AsString(str));
+ Py_DECREF(str);
} else {
PyErr_SetString(PyExc_TypeError, "expected a string or integer");
return 0;