[Python-checkins] [3.12] Fix Sphinx warnings in `re` module docs (GH-107044) (#107046)

AlexWaygood webhook-mailer at python.org
Sat Jul 22 11:54:05 EDT 2023


https://github.com/python/cpython/commit/844bdce712574feb339c3f91696930a38ad656a9
commit: 844bdce712574feb339c3f91696930a38ad656a9
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: AlexWaygood <Alex.Waygood at Gmail.com>
date: 2023-07-22T16:54:02+01:00
summary:

[3.12] Fix Sphinx warnings in `re` module docs (GH-107044) (#107046)

Fix Sphinx warnings in `re` module docs (GH-107044)
(cherry picked from commit 149748ea4f552e6fe43a1d6d69bd65910a7c4813)

Co-authored-by: wulmer <wulmer at users.noreply.github.com>

files:
M Doc/library/re.rst
M Doc/tools/.nitignore

diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index b7510b93d7542..629ee472cca68 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -501,6 +501,8 @@ The special characters are:
       in the ASCII range (``b'\x00'``-``b'\x7f'``).
 
 
+.. _re-special-sequences:
+
 The special sequences consist of ``'\'`` and a character from the list below.
 If the ordinary character is not an ASCII digit or an ASCII letter, then the
 resulting RE will match the second character.  For example, ``\$`` matches the
@@ -779,6 +781,17 @@ Flags
    Corresponds to the inline flag ``(?s)``.
 
 
+.. data:: U
+          UNICODE
+
+   In Python 2, this flag made :ref:`special sequences <re-special-sequences>`
+   include Unicode characters in matches. Since Python 3, Unicode characters
+   are matched by default.
+
+   See :const:`A` for restricting matching on ASCII characters instead.
+
+   This flag is only kept for backward compatibility.
+
 .. data:: X
           VERBOSE
 
@@ -1520,14 +1533,14 @@ Simulating scanf()
 
 .. index:: single: scanf()
 
-Python does not currently have an equivalent to :c:func:`scanf`.  Regular
+Python does not currently have an equivalent to :c:func:`!scanf`.  Regular
 expressions are generally more powerful, though also more verbose, than
-:c:func:`scanf` format strings.  The table below offers some more-or-less
-equivalent mappings between :c:func:`scanf` format tokens and regular
+:c:func:`!scanf` format strings.  The table below offers some more-or-less
+equivalent mappings between :c:func:`!scanf` format tokens and regular
 expressions.
 
 +--------------------------------+---------------------------------------------+
-| :c:func:`scanf` Token          | Regular Expression                          |
+| :c:func:`!scanf` Token         | Regular Expression                          |
 +================================+=============================================+
 | ``%c``                         | ``.``                                       |
 +--------------------------------+---------------------------------------------+
@@ -1552,7 +1565,7 @@ To extract the filename and numbers from a string like ::
 
    /usr/sbin/sendmail - 0 errors, 4 warnings
 
-you would use a :c:func:`scanf` format like ::
+you would use a :c:func:`!scanf` format like ::
 
    %s - %d errors, %d warnings
 
diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore
index 3a34c0b2cbfff..66b68305c5c69 100644
--- a/Doc/tools/.nitignore
+++ b/Doc/tools/.nitignore
@@ -188,7 +188,6 @@ Doc/library/pyclbr.rst
 Doc/library/pydoc.rst
 Doc/library/pyexpat.rst
 Doc/library/random.rst
-Doc/library/re.rst
 Doc/library/readline.rst
 Doc/library/reprlib.rst
 Doc/library/resource.rst



More information about the Python-checkins mailing list