mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
#11335: Fix memory leak when a sort key function throws an exception
This commit is contained in:
parent
2f283c2c19
commit
8eda5f7cd9
2 changed files with 5 additions and 0 deletions
|
|
@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #11335: Fixed a memory leak in list.sort when the key function
|
||||||
|
throws an exception.
|
||||||
|
|
||||||
- Issue #8923: When a string is encoded to UTF-8 in strict mode, the result is
|
- Issue #8923: When a string is encoded to UTF-8 in strict mode, the result is
|
||||||
cached into the object. Examples: str.encode(), str.encode('utf-8'),
|
cached into the object. Examples: str.encode(), str.encode('utf-8'),
|
||||||
PyUnicode_AsUTF8String() and PyUnicode_AsEncodedString(unicode, "utf-8",
|
PyUnicode_AsUTF8String() and PyUnicode_AsEncodedString(unicode, "utf-8",
|
||||||
|
|
|
||||||
|
|
@ -1957,6 +1957,8 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
||||||
if (keys[i] == NULL) {
|
if (keys[i] == NULL) {
|
||||||
for (i=i-1 ; i>=0 ; i--)
|
for (i=i-1 ; i>=0 ; i--)
|
||||||
Py_DECREF(keys[i]);
|
Py_DECREF(keys[i]);
|
||||||
|
if (keys != &ms.temparray[saved_ob_size+1])
|
||||||
|
PyMem_FREE(keys);
|
||||||
goto keyfunc_fail;
|
goto keyfunc_fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue