Commit 8a57f904 authored by Yury Selivanov's avatar Yury Selivanov

ssue #27942: Fix memory leak in codeobject.c

parent eb8afa76
...@@ -110,6 +110,8 @@ Core and Builtins ...@@ -110,6 +110,8 @@ Core and Builtins
- Issue #27443: __length_hint__() of bytearray iterators no longer return a - Issue #27443: __length_hint__() of bytearray iterators no longer return a
negative integer for a resized bytearray. negative integer for a resized bytearray.
- Issue #27942: Fix memory leak in codeobject.c
Library Library
------- -------
......
...@@ -69,6 +69,7 @@ intern_string_constants(PyObject *tuple) ...@@ -69,6 +69,7 @@ intern_string_constants(PyObject *tuple)
intern_string_constants(v); intern_string_constants(v);
} }
else if (PyFrozenSet_CheckExact(v)) { else if (PyFrozenSet_CheckExact(v)) {
PyObject *w = v;
PyObject *tmp = PySequence_Tuple(v); PyObject *tmp = PySequence_Tuple(v);
if (tmp == NULL) { if (tmp == NULL) {
PyErr_Clear(); PyErr_Clear();
...@@ -81,6 +82,7 @@ intern_string_constants(PyObject *tuple) ...@@ -81,6 +82,7 @@ intern_string_constants(PyObject *tuple)
} }
else { else {
PyTuple_SET_ITEM(tuple, i, v); PyTuple_SET_ITEM(tuple, i, v);
Py_DECREF(w);
modified = 1; modified = 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment