Patch #1049 by Thomas Lee.
Changes comparisons between PyBytes and PyUnicode to return unequal
instead of raising TypeError.
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index c7fe751..da2e23f 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -964,8 +964,8 @@
error, even if the comparison is for equality. */
if (PyObject_IsInstance(self, (PyObject*)&PyUnicode_Type) ||
PyObject_IsInstance(other, (PyObject*)&PyUnicode_Type)) {
- PyErr_SetString(PyExc_TypeError, "can't compare bytes and str");
- return NULL;
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
}
self_size = _getbuffer(self, &self_bytes);