Return [] for tags with no contents.
authorjbj <devnull@localhost>
Wed, 14 Jan 2004 16:20:04 +0000 (16:20 +0000)
committerjbj <devnull@localhost>
Wed, 14 Jan 2004 16:20:04 +0000 (16:20 +0000)
CVS patchset: 7078
CVS date: 2004/01/14 16:20:04

python/header-py.c

index 6def28c..a04121f 100644 (file)
@@ -490,6 +490,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
        }
     }
 
+    /* Retrieve data from extension or header. */
     if (ext) {
         ext->u.tagFunction(s->h, &type, (const void **) &data, &count, &freeData);
     } else {
@@ -498,6 +499,8 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
             return NULL;
         }
         
+       if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count))
+           return PyList_New(0);
     }
 
     switch (tag) {
@@ -538,16 +541,6 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
         break;
     }
 
-    if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count)) {
-       if (forceArray) {
-           return PyList_New(0);
-       }
-       else {
-            Py_INCREF(Py_None);
-            return Py_None;
-       }
-    }
-
     switch (type) {
     case RPM_BIN_TYPE:
        o = PyString_FromStringAndSize(data, count);