Skip to content

Commit

Permalink
Don't use "b" for strings with '\uxxxx'.
Browse files Browse the repository at this point in the history
This gives a SyntaxWarning in Python 3.12. In older Pythons it would
not warn, but in all cases it gives a literal raw \u (with a backslash)
instead of Unicode characters.

Python 2.x needed u'\uxxxx' but the u is no longer needed with 3.x.
  • Loading branch information
bartoldeman committed Mar 14, 2024
1 parent 1d4ede3 commit a7b4fb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/framework/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_run_cmd(self):
# this is constructed to reproduce errors like:
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2
# UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018'
for text in [b"foo \xe2 bar", b"foo \u2018 bar"]:
for text in [b"foo \xe2 bar", "foo \u2018 bar"]:
test_file = os.path.join(self.test_prefix, 'foo.txt')
write_file(test_file, text)
cmd = "cat %s" % test_file
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_run_shell_cmd_basic(self):
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2
# UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018'
# (such errors are ignored by the 'run' implementation)
for text in [b"foo \xe2 bar", b"foo \u2018 bar"]:
for text in [b"foo \xe2 bar", "foo \u2018 bar"]:
test_file = os.path.join(self.test_prefix, 'foo.txt')
write_file(test_file, text)
cmd = "cat %s" % test_file
Expand Down

0 comments on commit a7b4fb0

Please sign in to comment.