mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
gh-91595: fix the comparison of character and integer by using ord() (#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>
This commit is contained in:
parent
95573ade42
commit
9300b6d729
2 changed files with 2 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix the comparison of character and integer inside :func:`Tools.gdb.libpython.write_repr`. Patch by Yu Liu.
|
|
@ -1418,7 +1418,7 @@ class PyUnicodeObjectPtr(PyObjectPtr):
|
||||||
out.write('\\r')
|
out.write('\\r')
|
||||||
|
|
||||||
# Map non-printable US ASCII to '\xhh' */
|
# Map non-printable US ASCII to '\xhh' */
|
||||||
elif ch < ' ' or ch == 0x7F:
|
elif ch < ' ' or ord(ch) == 0x7F:
|
||||||
out.write('\\x')
|
out.write('\\x')
|
||||||
out.write(hexdigits[(ord(ch) >> 4) & 0x000F])
|
out.write(hexdigits[(ord(ch) >> 4) & 0x000F])
|
||||||
out.write(hexdigits[ord(ch) & 0x000F])
|
out.write(hexdigits[ord(ch) & 0x000F])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue