This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author johnchen902
Recipients johnchen902
Date 2018-06-28.17:43:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530207786.09.0.56676864532.issue33989@psf.upfronthosting.co.za>
In-reply-to
Content
Relevant code (Objects/listobject.c lines 2268 -- 2286 as of commit e76ac9d):

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

            if (key_type == &PyUnicode_Type && strings_are_latin) {
                ms.key_compare = unsafe_latin_compare;
            }
            else if (key_type == &PyLong_Type && ints_are_bounded) {
                ms.key_compare = unsafe_long_compare;
            }
            else if (key_type == &PyFloat_Type) {
                ms.key_compare = unsafe_float_compare;
            }
            else if ((ms.key_richcompare = key_type->tp_richcompare) != NULL) {
                ms.key_compare = unsafe_object_compare;
            }
        }
        else {
            ms.key_compare = safe_object_compare;
        }

Clearly, ms.key_compare is not assigned here if keys_are_all_same_type is true but key_type->tp_richcompare is NULL.

I don't know how to obtain an object with ob_type->tp_richcompare being NULL, though.
History
Date User Action Args
2018-06-28 17:43:06johnchen902setrecipients: + johnchen902
2018-06-28 17:43:06johnchen902setmessageid: <1530207786.09.0.56676864532.issue33989@psf.upfronthosting.co.za>
2018-06-28 17:43:06johnchen902linkissue33989 messages
2018-06-28 17:43:05johnchen902create