]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-106948: Add standard external names to nitpick_ignore (GH-106949) (#107061)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 23 Jul 2023 09:24:37 +0000 (12:24 +0300)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2023 09:24:37 +0000 (11:24 +0200)
It includes standard C types, macros and variables like "size_t",
"LONG_MAX" and "errno", and standard environment variables like "PATH"..
(cherry picked from commit f8b7fe2f2647813ae8249675a80e59c117d30fe1)

15 files changed:
Doc/c-api/arg.rst
Doc/c-api/memory.rst
Doc/c-api/unicode.rst
Doc/c-api/veryhigh.rst
Doc/conf.py
Doc/library/array.rst
Doc/library/ctypes.rst
Doc/library/os.rst
Doc/library/struct.rst
Doc/library/venv.rst
Doc/whatsnew/3.3.rst
Doc/whatsnew/3.5.rst
Doc/whatsnew/3.9.rst
Misc/NEWS.d/3.10.0a5.rst
Misc/NEWS.d/next/Documentation/2023-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst [new file with mode: 0644]

index ee130ab28510b02d7ead2985b893ced958f12daa..9f7fd2fa8629e69bf1aefdaa2f61c88967c681a6 100644 (file)
@@ -584,7 +584,7 @@ Building values
       Same as ``s#``.
 
    ``u`` (:class:`str`) [const wchar_t \*]
-      Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
+      Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
       data to a Python Unicode object.  If the Unicode buffer pointer is ``NULL``,
       ``None`` is returned.
 
index 35c356f25c6c70c116b8264d53b48889c52aa83d..4ca3b8804427f8f8a81115d91824a4f1ccff75c6 100644 (file)
@@ -581,7 +581,7 @@ that the treatment of negative indices differs from a Python slice):
     default).
 
     A serial number, incremented by 1 on each call to a malloc-like or
-    realloc-like function.  Big-endian ``size_t``.  If "bad memory" is detected
+    realloc-like function.  Big-endian :c:type:`size_t`.  If "bad memory" is detected
     later, the serial number gives an excellent way to set a breakpoint on the
     next run, to capture the instant at which this block was passed out.  The
     static function bumpserialno() in obmalloc.c is the only place the serial
index b2241ea8bd2e1bc91fc6c179b2c4736683febcd7..a96e0738f716e2fcfa808b9ce06c98fc0e192fe2 100644 (file)
@@ -58,7 +58,7 @@ Python:
 
 .. c:type:: Py_UNICODE
 
-   This is a typedef of :c:expr:`wchar_t`, which is a 16-bit type or 32-bit type
+   This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type
    depending on the platform.
 
    .. versionchanged:: 3.3
@@ -935,11 +935,11 @@ conversion function:
 wchar_t Support
 """""""""""""""
 
-:c:expr:`wchar_t` support for platforms which support it:
+:c:type:`wchar_t` support for platforms which support it:
 
 .. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
 
-   Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given *size*.
+   Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
    Passing ``-1`` as the *size* indicates that the function must itself compute the length,
    using wcslen.
    Return ``NULL`` on failure.
@@ -947,9 +947,9 @@ wchar_t Support
 
 .. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
 
-   Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*.  At most
-   *size* :c:expr:`wchar_t` characters are copied (excluding a possibly trailing
-   null termination character).  Return the number of :c:expr:`wchar_t` characters
+   Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*.  At most
+   *size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
+   null termination character).  Return the number of :c:type:`wchar_t` characters
    copied or ``-1`` in case of an error.  Note that the resulting :c:expr:`wchar_t*`
    string may or may not be null-terminated.  It is the responsibility of the caller
    to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
@@ -963,7 +963,7 @@ wchar_t Support
    Convert the Unicode object to a wide character string. The output string
    always ends with a null character. If *size* is not ``NULL``, write the number
    of wide characters (excluding the trailing null termination character) into
-   *\*size*. Note that the resulting :c:expr:`wchar_t` string might contain
+   *\*size*. Note that the resulting :c:type:`wchar_t` string might contain
    null characters, which would cause the string to be truncated when used with
    most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string
    contains null characters a :exc:`ValueError` is raised.
index cfbb44f4eb3a67b13b93f6183268e6598d39579d..79515c9df07edbc94c8993d7210ce09f308a997b 100644 (file)
@@ -17,7 +17,7 @@ parameter.  The available start symbols are :c:data:`Py_eval_input`,
 following the functions which accept them as parameters.
 
 Note also that several of these functions take :c:expr:`FILE*` parameters.  One
-particular issue which needs to be handled carefully is that the :c:expr:`FILE`
+particular issue which needs to be handled carefully is that the :c:type:`FILE`
 structure for different C libraries can be different and incompatible.  Under
 Windows (at least), it is possible for dynamically linked extensions to actually
 use different libraries, so care should be taken that :c:expr:`FILE*` parameters
index 3bd828f8ce9ed78d377c2518d1ceee860df76006..c082717efda723f1d11ba9fa79e7eb38758b9751 100644 (file)
@@ -72,6 +72,58 @@ if venvdir is not None:
     exclude_patterns.append(venvdir + '/*')
 
 nitpick_ignore = [
+    # Standard C types
+    ('c:type', 'FILE'),
+    ('c:type', '__int'),
+    ('c:type', 'intmax_t'),
+    ('c:type', 'off_t'),
+    ('c:type', 'ptrdiff_t'),
+    ('c:type', 'siginfo_t'),
+    ('c:type', 'size_t'),
+    ('c:type', 'ssize_t'),
+    ('c:type', 'time_t'),
+    ('c:type', 'uintmax_t'),
+    ('c:type', 'va_list'),
+    ('c:type', 'wchar_t'),
+    # Standard C macros
+    ('c:macro', 'LLONG_MAX'),
+    ('c:macro', 'LLONG_MIN'),
+    ('c:macro', 'LONG_MAX'),
+    ('c:macro', 'LONG_MIN'),
+    # Standard C variables
+    ('c:data', 'errno'),
+    # Standard environment variables
+    ('envvar', 'BROWSER'),
+    ('envvar', 'COLUMNS'),
+    ('envvar', 'COMSPEC'),
+    ('envvar', 'DISPLAY'),
+    ('envvar', 'HOME'),
+    ('envvar', 'HOMEDRIVE'),
+    ('envvar', 'HOMEPATH'),
+    ('envvar', 'IDLESTARTUP'),
+    ('envvar', 'LANG'),
+    ('envvar', 'LANGUAGE'),
+    ('envvar', 'LC_ALL'),
+    ('envvar', 'LC_CTYPE'),
+    ('envvar', 'LC_COLLATE'),
+    ('envvar', 'LC_MESSAGES'),
+    ('envvar', 'LC_MONETARY'),
+    ('envvar', 'LC_NUMERIC'),
+    ('envvar', 'LC_TIME'),
+    ('envvar', 'LINES'),
+    ('envvar', 'LOGNAME'),
+    ('envvar', 'PAGER'),
+    ('envvar', 'PATH'),
+    ('envvar', 'PATHEXT'),
+    ('envvar', 'SOURCE_DATE_EPOCH'),
+    ('envvar', 'TEMP'),
+    ('envvar', 'TERM'),
+    ('envvar', 'TMP'),
+    ('envvar', 'TMPDIR'),
+    ('envvar', 'TZ'),
+    ('envvar', 'USER'),
+    ('envvar', 'USERNAME'),
+    ('envvar', 'USERPROFILE'),
     # Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
     # be resolved, as the method is currently undocumented. For context, see
     # https://github.com/python/cpython/pull/103289.
index 75c49e0f6d1ebe54ab27828f91a5e3703e154bf7..d6cb8c623adbf15723e9915dc4bc40dc8f2c5494 100644 (file)
@@ -51,9 +51,9 @@ Notes:
    It can be 16 bits or 32 bits depending on the platform.
 
    .. versionchanged:: 3.9
-      ``array('u')`` now uses ``wchar_t`` as C type instead of deprecated
+      ``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated
       ``Py_UNICODE``. This change doesn't affect its behavior because
-      ``Py_UNICODE`` is alias of ``wchar_t`` since Python 3.3.
+      ``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3.
 
    .. deprecated-removed:: 3.3 4.0
 
index 2be2473f9b9a429e32e874cce2d1d92a498c573b..b55ec32ef5af57cfbd1810386441eac0b82eb138 100644 (file)
@@ -221,7 +221,7 @@ Fundamental data types
 +----------------------+------------------------------------------+----------------------------+
 | :class:`c_char`      | :c:expr:`char`                           | 1-character bytes object   |
 +----------------------+------------------------------------------+----------------------------+
-| :class:`c_wchar`     | :c:expr:`wchar_t`                        | 1-character string         |
+| :class:`c_wchar`     | :c:type:`wchar_t`                        | 1-character string         |
 +----------------------+------------------------------------------+----------------------------+
 | :class:`c_byte`      | :c:expr:`char`                           | int                        |
 +----------------------+------------------------------------------+----------------------------+
@@ -244,9 +244,9 @@ Fundamental data types
 | :class:`c_ulonglong` | :c:expr:`unsigned __int64` or            | int                        |
 |                      | :c:expr:`unsigned long long`             |                            |
 +----------------------+------------------------------------------+----------------------------+
-| :class:`c_size_t`    | :c:expr:`size_t`                         | int                        |
+| :class:`c_size_t`    | :c:type:`size_t`                         | int                        |
 +----------------------+------------------------------------------+----------------------------+
-| :class:`c_ssize_t`   | :c:expr:`ssize_t` or                     | int                        |
+| :class:`c_ssize_t`   | :c:type:`ssize_t` or                     | int                        |
 |                      | :c:expr:`Py_ssize_t`                     |                            |
 +----------------------+------------------------------------------+----------------------------+
 | :class:`c_float`     | :c:expr:`float`                          | float                      |
@@ -334,7 +334,7 @@ property::
 
 The :func:`create_string_buffer` function replaces the old :func:`c_buffer`
 function (which is still available as an alias).  To create a mutable memory
-block containing unicode characters of the C type :c:expr:`wchar_t`, use the
+block containing unicode characters of the C type :c:type:`wchar_t`, use the
 :func:`create_unicode_buffer` function.
 
 
@@ -2361,7 +2361,7 @@ These are the fundamental ctypes data types:
 
 .. class:: c_wchar
 
-   Represents the C :c:expr:`wchar_t` datatype, and interprets the value as a
+   Represents the C :c:type:`wchar_t` datatype, and interprets the value as a
    single character unicode string.  The constructor accepts an optional string
    initializer, the length of the string must be exactly one character.
 
index 283dc5ad1541a18bbb592a3cc8bd509d0ba89e86..9d6d02652db908b35bffd6df9cc3ecac4ebe47b8 100644 (file)
@@ -4410,7 +4410,7 @@ written in Python, such as a mail server's external command delivery program.
    :data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags.
 
    The return value is an object representing the data contained in the
-   :c:type:`!siginfo_t` structure with the following attributes:
+   :c:type:`siginfo_t` structure with the following attributes:
 
    * :attr:`!si_pid` (process ID)
    * :attr:`!si_uid` (real user ID of the child)
index 26c8d650382cebb758ea15e07d57006e55ddd648..416b01db615fa0575b43eeceac1248c8f065187c 100644 (file)
@@ -231,9 +231,9 @@ platform-dependent.
 | ``Q``  | :c:expr:`unsigned long   | integer            | 8              | \(2)       |
 |        | long`                    |                    |                |            |
 +--------+--------------------------+--------------------+----------------+------------+
-| ``n``  | :c:expr:`ssize_t`        | integer            |                | \(3)       |
+| ``n``  | :c:type:`ssize_t`        | integer            |                | \(3)       |
 +--------+--------------------------+--------------------+----------------+------------+
-| ``N``  | :c:expr:`size_t`         | integer            |                | \(3)       |
+| ``N``  | :c:type:`size_t`         | integer            |                | \(3)       |
 +--------+--------------------------+--------------------+----------------+------------+
 | ``e``  | \(6)                     | float              | 2              | \(4)       |
 +--------+--------------------------+--------------------+----------------+------------+
index 07a6f5f8920f9c18ca3acb1cb506d2e4839cc0ce..0b9787d095d9adb61a642e33e7c25fce0d9fbea1 100644 (file)
@@ -60,7 +60,7 @@ running from a virtual environment.
 
 A virtual environment may be "activated" using a script in its binary directory
 (``bin`` on POSIX; ``Scripts`` on Windows).
-This will prepend that directory to your :envvar:`!PATH`, so that running
+This will prepend that directory to your :envvar:`PATH`, so that running
 :program:`python` will invoke the environment's Python interpreter
 and you can run installed scripts without having to use their full path.
 The invocation of the activation script is platform-specific
@@ -100,10 +100,10 @@ In order to achieve this, scripts installed into virtual environments have
 a "shebang" line which points to the environment's Python interpreter,
 i.e. :samp:`#!/{<path-to-venv>}/bin/python`.
 This means that the script will run with that interpreter regardless of the
-value of :envvar:`!PATH`. On Windows, "shebang" line processing is supported if
+value of :envvar:`PATH`. On Windows, "shebang" line processing is supported if
 you have the :ref:`launcher` installed. Thus, double-clicking an installed
 script in a Windows Explorer window should run it with the correct interpreter
-without the environment needing to be activated or on the :envvar:`!PATH`.
+without the environment needing to be activated or on the :envvar:`PATH`.
 
 When a virtual environment has been activated, the :envvar:`!VIRTUAL_ENV`
 environment variable is set to the path of the environment.
index 782048c397f9730a47272d02b348882a70c4270a..e3e49640f6c91693575ccf7a7b4f038ff2e568d4 100644 (file)
@@ -1983,7 +1983,7 @@ the form '-rwxrwxrwx'.
 struct
 ------
 
-The :mod:`struct` module now supports ``ssize_t`` and ``size_t`` via the
+The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` via the
 new codes ``n`` and ``N``, respectively.  (Contributed by Antoine Pitrou
 in :issue:`3163`.)
 
index 69d9147524caedda6287097e4b4663f5348f4680..315de6b59fe5f01b6b531c6fb51a8fd8654a332f 100644 (file)
@@ -2192,7 +2192,7 @@ encode error with ``\N{...}`` escapes.
 (Contributed by Serhiy Storchaka in :issue:`19676`.)
 
 A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`,
-but accepts a ``va_list`` argument.
+but accepts a :c:type:`va_list` argument.
 (Contributed by Antoine Pitrou in :issue:`18711`.)
 
 A new :c:data:`PyExc_RecursionError` exception.
index 1f0fbbc219666468e2308c38d0a81bd9fae4c82a..23db4022dc06a0c39c315bc7abfb8933b0a315ef 100644 (file)
@@ -1115,9 +1115,9 @@ Changes in the Python API
   ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
   (Contributed by Batuhan Taskaya in :issue:`39562`)
 
-* ``array('u')`` now uses ``wchar_t`` as C type instead of ``Py_UNICODE``.
+* ``array('u')`` now uses :c:type:`wchar_t` as C type instead of ``Py_UNICODE``.
   This change doesn't affect to its behavior because ``Py_UNICODE`` is alias
-  of ``wchar_t`` since Python 3.3.
+  of :c:type:`wchar_t` since Python 3.3.
   (Contributed by Inada Naoki in :issue:`34538`.)
 
 * The :func:`logging.getLogger` API now returns the root logger when passed
index 1c7c7447cae065e4c31fd2cea83ea926e9be1a3c..2854afcc8f84f5fe27c8cb1d8e7a0abcc1c513c1 100644 (file)
@@ -667,4 +667,4 @@ exception (if an exception is set). Patch by Victor Stinner.
 .. section: C API
 
 Fixed a compiler warning in :c:func:`Py_UNICODE_ISSPACE()` on platforms with
-signed ``wchar_t``.
+signed :c:type:`wchar_t`.
diff --git a/Misc/NEWS.d/next/Documentation/2023-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst b/Misc/NEWS.d/next/Documentation/2023-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst
new file mode 100644 (file)
index 0000000..42b6348
--- /dev/null
@@ -0,0 +1 @@
+Add a number of standard external names to ``nitpick_ignore``.