summaryrefslogtreecommitdiffstats
path: root/src/xmlpythonizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpythonizer.c')
-rw-r--r--src/xmlpythonizer.c8
1 files changed, 5 insertions, 3 deletions
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); \
+ } \
}