summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-04-16 14:57:07 (GMT)
committerGitHub <noreply@github.com>2022-04-16 14:57:07 (GMT)
commitc171d757f3892263e163eddd702ae5249308404d (patch)
treed829ac427a3cd7719189a9989ae4ec3ae4b06d75
parent514162b835a86173d63ea83f8fe39b9af32c3fa5 (diff)
downloadcpython-c171d757f3892263e163eddd702ae5249308404d.zip
cpython-c171d757f3892263e163eddd702ae5249308404d.tar.gz
cpython-c171d757f3892263e163eddd702ae5249308404d.tar.bz2
gh-91595: fix the comparison of character and integer by using ord() (GH-91596)
* 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> (cherry picked from commit 9300b6d72948b94c0924a75ea14c6298156522d0) Co-authored-by: Yu Liu <yuki.liu@utexas.edu>
-rw-r--r--Misc/NEWS.d/next/Library/2022-04-16-05-12-13.gh-issue-91595.CocJBv.rst1
-rwxr-xr-xTools/gdb/libpython.py2
2 files changed, 2 insertions, 1 deletions
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 45be5ab..cc0cd2f 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -1285,7 +1285,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])