Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix indentation
  • Loading branch information
Rémi Lapeyre committed Mar 22, 2019
commit 6286a4bf12bfd4b4d5141582e7a192dbaf606749
19 changes: 11 additions & 8 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2314,17 +2314,20 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
}

if (keys_are_all_same_type) {
if (key_type == &PyLong_Type) {
if (ints_are_bounded && Py_ABS(Py_SIZE(key)) > 1)
ints_are_bounded = 0;
if (key_type == &PyLong_Type &&
ints_are_bounded &&
Py_ABS(Py_SIZE(key)) > 1) {

ints_are_bounded = 0;
}
else if (key_type == &PyUnicode_Type) {
if (strings_are_latin &&
PyUnicode_KIND(key) != PyUnicode_1BYTE_KIND)
strings_are_latin = 0;
else if (key_type == &PyUnicode_Type &&
strings_are_latin &&
PyUnicode_KIND(key) != PyUnicode_1BYTE_KIND) {

strings_are_latin = 0;
}
}
}
}

/* Choose the best compare, given what we now know about the keys. */
if (keys_are_all_same_type) {
Expand Down