diff Objects/bytesobject.c @ 43508:47c02791ec6b

Patch #1049 by Thomas Lee. Changes comparisons between PyBytes and PyUnicode to return unequal instead of raising TypeError.
author Guido van Rossum <guido@python.org>
date Tue, 09 Oct 2007 17:21:10 +0000
parents 0476a2cc5658
children 697cc31a83f6
line wrap: on
line diff
--- a/Objects/bytesobject.c	Tue Oct 09 03:46:30 2007 +0000
+++ b/Objects/bytesobject.c	Tue Oct 09 17:21:10 2007 +0000
@@ -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);