Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42431: Fix outdated bytes comments #23458

Merged
merged 4 commits into from
Dec 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'master' into bytes-comments
  • Loading branch information
serhiy-storchaka authored Nov 25, 2020
commit 6b88e003a57d1b9adf797525128d11878a0c9de1
17 changes: 7 additions & 10 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,16 +1006,13 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op)
Py_buffer self_bytes, other_bytes;
int cmp;

rc = PyObject_IsInstance(self, (PyObject*)&PyUnicode_Type);
if (!rc)
rc = PyObject_IsInstance(other, (PyObject*)&PyUnicode_Type);
if (rc < 0)
return NULL;
if (rc) {
if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) {
if (PyErr_WarnEx(PyExc_BytesWarning,
"Comparison between bytearray and string", 1))
return NULL;
if (!PyObject_CheckBuffer(self) || !PyObject_CheckBuffer(other)) {
if (PyUnicode_Check(self) || PyUnicode_Check(other)) {
if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) {
if (PyErr_WarnEx(PyExc_BytesWarning,
"Comparison between bytearray and string", 1))
return NULL;
}
}
Py_RETURN_NOTIMPLEMENTED;
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.