diff options
author | Guido van Rossum <guido@python.org> | 2007-10-09 17:21:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-10-09 17:21:10 (GMT) |
commit | 1e35e765321311222f118197c79f2c3937035ffc (patch) | |
tree | da550a2a6e205185eb215a9bd9e5cdabb1b92a12 /Objects | |
parent | 6ccd3f2dbcb98b33a71ffa6eae949deae797c09c (diff) | |
download | cpython-1e35e765321311222f118197c79f2c3937035ffc.zip cpython-1e35e765321311222f118197c79f2c3937035ffc.tar.gz cpython-1e35e765321311222f118197c79f2c3937035ffc.tar.bz2 |
Patch #1049 by Thomas Lee.
Changes comparisons between PyBytes and PyUnicode to return unequal
instead of raising TypeError.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 @@ 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); |