summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2008-10-17 01:50:37 (GMT)
committerBarry Warsaw <barry@python.org>2008-10-17 01:50:37 (GMT)
commit9e9dcd6d4225faa6a8b19120f009e0253d16ab92 (patch)
treec76fbecc98e4f8d86073f3245e84bdacad3c6ec2 /Objects
parente94a37f3a1b4bbd46f50922edcdf9293954fdd01 (diff)
downloadcpython-9e9dcd6d4225faa6a8b19120f009e0253d16ab92.zip
cpython-9e9dcd6d4225faa6a8b19120f009e0253d16ab92.tar.gz
cpython-9e9dcd6d4225faa6a8b19120f009e0253d16ab92.tar.bz2
STINNER Victor (haypo)'s patch for bug 3988, Byte warning mode and b'' != ''
Also, his patch to runtests.sh to pass the -bb option (issue 4125).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytearrayobject.c2
-rw-r--r--Objects/bytesobject.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 03e51e8..997a835 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -939,7 +939,7 @@ 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)) {
- if (Py_BytesWarningFlag && op == Py_EQ) {
+ if (Py_BytesWarningFlag && (op == Py_EQ || op == Py_NE)) {
if (PyErr_WarnEx(PyExc_BytesWarning,
"Comparison between bytearray and string", 1))
return NULL;
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 0d0efc9..76b7f52 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -818,7 +818,7 @@ string_richcompare(PyBytesObject *a, PyBytesObject *b, int op)
/* Make sure both arguments are strings. */
if (!(PyBytes_Check(a) && PyBytes_Check(b))) {
- if (Py_BytesWarningFlag && (op == Py_EQ) &&
+ if (Py_BytesWarningFlag && (op == Py_EQ || op == Py_NE) &&
(PyObject_IsInstance((PyObject*)a,
(PyObject*)&PyUnicode_Type) ||
PyObject_IsInstance((PyObject*)b,