summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-09-01 09:40:52 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-09-01 09:40:52 +0300
commit8fb5d95eda38c282a03eb1db891de695e51cb67b (patch)
tree803eb2addb69c8f9d362c2939848150a27f06d6a /python
parentf07ab5c1afa9b0b7105082a8617ec6a7657fc27e (diff)
downloadlibrpm-tizen-8fb5d95eda38c282a03eb1db891de695e51cb67b.tar.gz
librpm-tizen-8fb5d95eda38c282a03eb1db891de695e51cb67b.tar.bz2
librpm-tizen-8fb5d95eda38c282a03eb1db891de695e51cb67b.zip
Avoid SystemError on inserting an empty list insert to header from python
Diffstat (limited to 'python')
-rw-r--r--python/header-py.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/header-py.c b/python/header-py.c
index 3482dd2a8..6d6c1e9ae 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -510,6 +510,8 @@ static int validData(rpmTagVal tag, rpmTagType type, rpmTagReturnType retype, Py
} else if (retype == RPM_ARRAY_RETURN_TYPE && PyList_Check(value)) {
/* python lists can contain arbitrary objects, validate each item */
Py_ssize_t len = PyList_Size(value);
+ if (len == 0)
+ valid = 0;
for (Py_ssize_t i = 0; i < len; i++) {
PyObject *item = PyList_GetItem(value, i);
if (!validItem(tclass, item)) {