From 9c651823c9d4bb918c7b7bb618a3a6275ee22619 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 19 Jun 2009 11:16:08 +0200 Subject: Fixed incorrectly Py_DECREC() on Py_None values --- src/xmlpythonizer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/xmlpythonizer.c') diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c index 6704d1b..ba018eb 100644 --- a/src/xmlpythonizer.c +++ b/src/xmlpythonizer.c @@ -748,9 +748,11 @@ char *_get_key_value(char *key, size_t buflen, ptzMAP *map_p, xmlXPathContext *x * @param PyObject* Pointer to the Python value */ -#define PyADD_DICT_VALUE(p, k, v) { \ - PyDict_SetItemString(p, k, v); \ - Py_DECREF(v); \ +#define PyADD_DICT_VALUE(p, k, v) { \ + PyDict_SetItemString(p, k, v); \ + if( v != Py_None ) { \ + Py_DECREF(v); \ + } \ } -- cgit