From 9300b6d72948b94c0924a75ea14c6298156522d0 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Sat, 16 Apr 2022 09:34:48 -0500 Subject: gh-91595: fix the comparison of character and integer by using ord() (#91596) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix the comparison of character and integer by using ord() * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> --- Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst | 1 + Tools/gdb/libpython.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst diff --git a/Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst b/Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst new file mode 100644 index 0000000..637079a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst @@ -0,0 +1 @@ +Fix the comparison of character and integer inside :func:`Tools.gdb.libpython.write_repr`. Patch by Yu Liu. diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 4f7a8bc..610d130 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1418,7 +1418,7 @@ class PyUnicodeObjectPtr(PyObjectPtr): out.write('\\r') # Map non-printable US ASCII to '\xhh' */ - elif ch < ' ' or ch == 0x7F: + elif ch < ' ' or ord(ch) == 0x7F: out.write('\\x') out.write(hexdigits[(ord(ch) >> 4) & 0x000F]) out.write(hexdigits[ord(ch) & 0x000F]) -- cgit v0.12