From a7b4fb09bd51b05ab080467c72735a6e6428fb48 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Wed, 13 Mar 2024 21:45:47 -0400 Subject: [PATCH] Don't use "b" for strings with '\uxxxx'. 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. --- test/framework/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/run.py b/test/framework/run.py index 2f16e3978a..539523909f 100644 --- a/test/framework/run.py +++ b/test/framework/run.py @@ -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 @@ -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