diff options
author | David Sommerseth <davids@redhat.com> | 2009-06-09 21:16:21 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-06-09 21:16:21 +0200 |
commit | 19a78f3ec9dd41298f8e84dbf58da71901b42c6c (patch) | |
tree | 6b497517640957a2c724da35d3e8be41641621b3 | |
parent | 80bf200604d80703f9ef02fe8a4a505b6cd96ab6 (diff) | |
download | python-dmidecode-19a78f3ec9dd41298f8e84dbf58da71901b42c6c.tar.gz python-dmidecode-19a78f3ec9dd41298f8e84dbf58da71901b42c6c.tar.xz python-dmidecode-19a78f3ec9dd41298f8e84dbf58da71901b42c6c.zip |
Don't set exceptions when it should already be set
-rw-r--r-- | src/xmlpythonizer.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c index fbf01fd..68c29c2 100644 --- a/src/xmlpythonizer.c +++ b/src/xmlpythonizer.c @@ -968,7 +968,6 @@ PyObject *_deep_pythonize(PyObject *retdata, ptzMAP *map_p, xmlNode *data_n, int // If we have a fixed list and we have a index value for the list if( (map_p->fixed_list_size > 0) && (map_p->list_index != NULL) ) { char *idx = NULL; - idx = dmixml_GetAttrValue(xpo->nodesetval->nodeTab[i], map_p->list_index); if( idx != NULL ) { @@ -978,6 +977,9 @@ PyObject *_deep_pythonize(PyObject *retdata, ptzMAP *map_p, xmlNode *data_n, int // No list index - append the value PyList_Append(value, dataset); } + } else { + // If NULL, something is wrong - exception is already set. + return NULL; } } PyADD_DICT_VALUE(retdata, key, value); @@ -1052,15 +1054,25 @@ PyObject *pythonizeXMLnode(ptzMAP *in_map, xmlNode *data_n) { xpctx->node = xpo->nodesetval->nodeTab[i]; if( _get_key_value(key, 256, map_p, xpctx, 0) != NULL ) { - _deep_pythonize(retdata, map_p, - xpo->nodesetval->nodeTab[i], i); + PyObject *res = _deep_pythonize(retdata, map_p, + xpo->nodesetval->nodeTab[i], i); + if( res == NULL ) { + // Exit if we get NULL - something is wrong + //and exception is set + return NULL; + } } } xmlXPathFreeObject(xpo); xmlXPathFreeContext(xpctx); xmlFreeDoc(xpdoc); } else { - _deep_pythonize(retdata, map_p, data_n, 0); + PyObject *res = _deep_pythonize(retdata, map_p, data_n, 0); + if( res == NULL ) { + // Exit if we get NULL - something is wrong + //and exception is set + return NULL; + } } } free(key); |