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 9300b6d729)

Co-authored-by: Yu Liu <yuki.liu@utexas.edu>
This commit is contained in:
Miss Islington (bot) 2022-04-16 07:59:32 -07:00 committed by GitHub
parent f5542ecf6d
commit 84c279b514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -1291,7 +1291,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])