Skip to content

Commit d2fd359

Browse files
author
Yury Selivanov
committed
ssue python#27942: Fix memory leak in codeobject.c
1 parent 58c534d commit d2fd359

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎Misc/NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Core and Builtins
110110
- Issue #27443: __length_hint__() of bytearray iterators no longer return a
111111
negative integer for a resized bytearray.
112112

113+
- Issue #27942: Fix memory leak in codeobject.c
114+
113115
Library
114116
-------
115117

‎Objects/codeobject.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ intern_string_constants(PyObject *tuple)
6969
intern_string_constants(v);
7070
}
7171
else if (PyFrozenSet_CheckExact(v)) {
72+
PyObject *w = v;
7273
PyObject *tmp = PySequence_Tuple(v);
7374
if (tmp == NULL) {
7475
PyErr_Clear();
@@ -81,6 +82,7 @@ intern_string_constants(PyObject *tuple)
8182
}
8283
else {
8384
PyTuple_SET_ITEM(tuple, i, v);
85+
Py_DECREF(w);
8486
modified = 1;
8587
}
8688
}

0 commit comments

Comments
 (0)