summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 34f381a..d985fc7 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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 ||