summaryrefslogtreecommitdiff
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-09 17:21:10 +0000
committerGuido van Rossum <guido@python.org>2007-10-09 17:21:10 +0000
commit1e35e765321311222f118197c79f2c3937035ffc (patch)
treeda550a2a6e205185eb215a9bd9e5cdabb1b92a12 /Objects/bytesobject.c
parent6ccd3f2dbcb98b33a71ffa6eae949deae797c09c (diff)
downloadcpython-git-1e35e765321311222f118197c79f2c3937035ffc.tar.gz
Patch #1049 by Thomas Lee.
Changes comparisons between PyBytes and PyUnicode to return unequal instead of raising TypeError.
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index c7fe751562..da2e23f1f6 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -964,8 +964,8 @@ bytes_richcompare(PyObject *self, PyObject *other, int op)
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);