mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Bytes should never equal unicode.
Add tests for str <cmpop> bytes.
This commit is contained in:
parent
343e97ff7f
commit
ebea9beab3
2 changed files with 27 additions and 1 deletions
|
@ -848,7 +848,12 @@ bytes_richcompare(PyObject *self, PyObject *other, int op)
|
|||
int cmp;
|
||||
|
||||
/* For backwards compatibility, bytes can be compared to anything that
|
||||
supports the (binary) buffer API. */
|
||||
supports the (binary) buffer API. Except Unicode. */
|
||||
|
||||
if (PyUnicode_Check(self) || PyUnicode_Check(other)) {
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
|
||||
self_buffer = self->ob_type->tp_as_buffer;
|
||||
if (self_buffer == NULL ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue