From 8fb5d95eda38c282a03eb1db891de695e51cb67b Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 1 Sep 2011 09:40:52 +0300 Subject: [PATCH] Avoid SystemError on inserting an empty list insert to header from python --- python/header-py.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/header-py.c b/python/header-py.c index 3482dd2..6d6c1e9 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)) { -- 2.7.4