mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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).
This commit is contained in:
parent
e94a37f3a1
commit
9e9dcd6d42
3 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue