Collin Funk <collin.fu...@gmail.com> writes: > In the documentation for \w it states [2]: > > Matches [a-zA-Z0-9_] if the ASCII flag is used.
I've committed this patch adding the ASCII flag. I noticed some other duplicated regular expressions that could probably be simplified. I'll take a look at seeing if re.ASCII is applicable to those too. Collin
>From 1b74469a3aaa1a4bbe94272fde87c2335afb89e1 Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Wed, 29 May 2024 02:35:02 -0700 Subject: [PATCH] gnulib-tool.py: Don't emit non-ASCII shell output. Reported by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00441.html>. * pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Use the re.ASCII flag for the regular expression. --- ChangeLog | 8 ++++++++ pygnulib/GLModuleSystem.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9c22b7fb38..87e25ab81e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-05-29 Collin Funk <collin.fu...@gmail.com> + + gnulib-tool.py: Don't emit non-ASCII shell output. + Reported by Bruno Haible in + <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00441.html>. + * pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Use the re.ASCII + flag for the regular expression. + 2024-05-28 Collin Funk <collin.fu...@gmail.com> gnulib-tool.py: Add missing docstring. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index f1774f64fc..5b8d331dd6 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -167,7 +167,7 @@ class GLModule: re.M) # Regular expression matching module names that can be used as shell ids. - shell_id_pattern: ClassVar[re.Pattern] = re.compile(r'^\w*$') + shell_id_pattern: ClassVar[re.Pattern] = re.compile(r'^\w*$', re.ASCII) cache: dict[str, Any] content: str -- 2.45.1