[RFC PATCH] scripts/feature_to_c.py: fix invalid escape

Alex Bennée posted 1 patch 1 week, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260812155636.4158158-1-alex.bennee@linaro.org
Maintainers: John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@mailo.com>
scripts/feature_to_c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[RFC PATCH] scripts/feature_to_c.py: fix invalid escape
Posted by Alex Bennée 1 week, 6 days ago
This leg of the python code is trying to emit literal octal values but
bodges the escape sequence. The newer python on my macOS box
complained:

  /Users/alex/lsrc/qemu.git/gdbstub/../scripts/feature_to_c.py:28: SyntaxWarning: "\{" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\{"? A raw string is also an option.
    sys.stdout.write(f'\{c:03o}')

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 scripts/feature_to_c.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py
index a52cd2e9ec6..4275b758172 100644
--- a/scripts/feature_to_c.py
+++ b/scripts/feature_to_c.py
@@ -25,7 +25,7 @@ def writeliteral(indent, bytes):
         elif c >= 32 and c < 127:
             sys.stdout.write(c.to_bytes(1, 'big').decode())
         else:
-            sys.stdout.write(f'\{c:03o}')
+            sys.stdout.write(f'\\{c:03o}')
 
     if quoted:
         sys.stdout.write('"')
-- 
2.47.3