[PATCH] docs/sphinx: avoid invalid escape in Python string

Paolo Bonzini posted 1 patch 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231016094016.173598-1-pbonzini@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>
docs/sphinx/hxtool.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] docs/sphinx: avoid invalid escape in Python string
Posted by Paolo Bonzini 1 year, 1 month ago
This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/sphinx/hxtool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/sphinx/hxtool.py b/docs/sphinx/hxtool.py
index fb0649a3d5b..9f6b9d87dcc 100644
--- a/docs/sphinx/hxtool.py
+++ b/docs/sphinx/hxtool.py
@@ -49,7 +49,7 @@ def serror(file, lnum, errtext):
 
 def parse_directive(line):
     """Return first word of line, if any"""
-    return re.split('\W', line)[0]
+    return re.split(r'\W', line)[0]
 
 def parse_defheading(file, lnum, line):
     """Handle a DEFHEADING directive"""
-- 
2.41.0
Re: [PATCH] docs/sphinx: avoid invalid escape in Python string
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
On 16/10/23 11:40, Paolo Bonzini wrote:
> This is an error in Python 3.12; fix it by using a raw string literal.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   docs/sphinx/hxtool.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>