summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-02-21 00:05:22 -0800
committerGitHub <noreply@github.com>2019-02-21 00:05:22 -0800
commit0e73ea26a55abc0ce2ee1153e5509bcaef4736cf (patch)
tree169770ee6450434483d704cd7574f8c2e780cba6 /Objects
parent92ac01b104b80f9251fcb17ab4cc1845c1f91ac2 (diff)
downloadcpython-git-0e73ea26a55abc0ce2ee1153e5509bcaef4736cf.tar.gz
bpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl(). (GH-8710)
(cherry picked from commit ebc793d6acb9650b9f497808e059805892031d74) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index de73b8bf80..7dc68a73bd 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2279,6 +2279,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;