diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-18 15:57:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 06:57:10 -0800 |
commit | d1e38d4023aa29e7ed64d4f8eb9c1e4a3c86a2e5 (patch) | |
tree | cbeb8dae434536963656a24fdebfddc0348617bb /Python | |
parent | bpo-42398: Fix "make regen-all" race condition (GH-23362) (diff) | |
download | cpython-d1e38d4023aa29e7ed64d4f8eb9c1e4a3c86a2e5.tar.gz cpython-d1e38d4023aa29e7ed64d4f8eb9c1e4a3c86a2e5.tar.bz2 cpython-d1e38d4023aa29e7ed64d4f8eb9c1e4a3c86a2e5.zip |
bpo-40998: Fix a refleak in create_filter() (GH-23365)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 8d33fbe0f87..313420c6314 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -69,12 +69,14 @@ create_filter(PyObject *category, _Py_Identifier *id, const char *modname) return NULL; } } else { - modname_obj = Py_None; + modname_obj = Py_NewRef(Py_None); } /* This assumes the line number is zero for now. */ - return PyTuple_Pack(5, action_str, Py_None, - category, modname_obj, _PyLong_GetZero()); + PyObject *filter = PyTuple_Pack(5, action_str, Py_None, + category, modname_obj, _PyLong_GetZero()); + Py_DECREF(modname_obj); + return filter; } #endif |