mirror of https://github.com/python/cpython
bpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl(). (GH-8710)
This commit is contained in:
parent
ef1b88bf57
commit
ebc793d6ac
|
@ -0,0 +1,2 @@
|
|||
Fix a possible crash in :meth:`list.sort` when sorting objects with
|
||||
``ob_type->tp_richcompare == NULL``. Patch by Zackery Spytz.
|
|
@ -2334,6 +2334,9 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
|
|||
else if ((ms.key_richcompare = key_type->tp_richcompare) != NULL) {
|
||||
ms.key_compare = unsafe_object_compare;
|
||||
}
|
||||
else {
|
||||
ms.key_compare = safe_object_compare;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ms.key_compare = safe_object_compare;
|
||||
|
|
Loading…
Reference in New Issue