From 002af297808049d8a4a034ba4e76a9251e2384d6 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 9 Nov 2022 19:22:18 -0500 Subject: [PATCH 1/3] gh-99308: Fix wording of the deprecation notice in re for 3.12 --- Doc/library/re.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 0034b46fb1ced2..2ba74740b54a74 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -496,6 +496,8 @@ The special characters are: .. versionchanged:: 3.12 Group *id* can only contain ASCII digits. + In bytes replacement strings group names must contain only characters + in the ASCII range. The special sequences consist of ``'\'`` and a character from the list below. From 0aa22606b10ee547b2725444e1f569a2deb45afe Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 30 Nov 2022 12:28:59 -0800 Subject: [PATCH 2/3] gh-99308: Fix typos and make wording consistent --- Doc/library/re.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 2ba74740b54a74..a3f18d9558e339 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -395,9 +395,9 @@ The special characters are: ``(?P...)`` Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group name *name*. Group names must be valid - Python identifiers, and in bytes patterns they must contain only characters - in the ASCII range. Each group name must be defined only once within a - regular expression. A symbolic group is also a numbered group, just as if + Python identifiers, and in :class:`bytes` patterns they can only contain + bytes in the ASCII range. Each group name must be defined only once within + a regular expression. A symbolic group is also a numbered group, just as if the group were not named. Named groups can be referenced in three contexts. If the pattern is @@ -419,8 +419,8 @@ The special characters are: +---------------------------------------+----------------------------------+ .. versionchanged:: 3.12 - In bytes patterns group names must contain only characters in - the ASCII range. + In :class:`bytes` patterns, group *name* can only contain bytes + in the ASCII range (``b'\x00'``-``b'\x7f'``). .. index:: single: (?P=; in regular expressions @@ -496,8 +496,8 @@ The special characters are: .. versionchanged:: 3.12 Group *id* can only contain ASCII digits. - In bytes replacement strings group names must contain only characters - in the ASCII range. + In :class:`bytes` patterns, group *name* can only contain bytes + in the ASCII range (``b'\x00'``-``b'\x7f'``). The special sequences consist of ``'\'`` and a character from the list below. @@ -1020,8 +1020,8 @@ Functions .. versionchanged:: 3.12 Group *id* can only contain ASCII digits. - In bytes replacement strings group names must contain only characters - in the ASCII range. + In :class:`bytes` replacement strings, group *name* can only contain bytes + in the ASCII range (``b'\x00'``-``b'\x7f'``) .. function:: subn(pattern, repl, string, count=0, flags=0) From 65b94532cec3e54fec9a748b6b8b280232cce6af Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 30 Nov 2022 12:30:22 -0800 Subject: [PATCH 3/3] gh-99308: Fix missing dot. --- Doc/library/re.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index a3f18d9558e339..f49477c5907295 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1021,7 +1021,7 @@ Functions .. versionchanged:: 3.12 Group *id* can only contain ASCII digits. In :class:`bytes` replacement strings, group *name* can only contain bytes - in the ASCII range (``b'\x00'``-``b'\x7f'``) + in the ASCII range (``b'\x00'``-``b'\x7f'``). .. function:: subn(pattern, repl, string, count=0, flags=0)