summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 4d65bb3..91a78fe 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -69,11 +69,14 @@ create_filter(PyObject *category, _Py_Identifier *id, const char *modname)
}
} else {
modname_obj = Py_None;
+ Py_INCREF(modname_obj);
}
/* This assumes the line number is zero for now. */
- return PyTuple_Pack(5, action_str, Py_None,
- category, modname_obj, _PyLong_Zero);
+ PyObject *filter = PyTuple_Pack(5, action_str, Py_None,
+ category, modname_obj, _PyLong_Zero);
+ Py_DECREF(modname_obj);
+ return filter;
}
#endif