From 9079a3469cb95d466d36f0e3e331397978b317e9 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 21 Jul 2023 11:40:15 +0300 Subject: [PATCH 1/9] gh-106948: Add standard external names to nitpick_ignore It includes standard C types, macros and variables like "size_t", "LONG_MAX" and "errno", and standard environment variables like "PATH". --- Doc/conf.py | 49 +++++++++++++++++++ ...-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst | 1 + 2 files changed, 50 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2023-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst diff --git a/Doc/conf.py b/Doc/conf.py index 09e12e245891d2..3f2db4c8c96c53 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -77,6 +77,55 @@ exclude_patterns.append(venvdir + '/*') nitpick_ignore = [ + # Standard C types + ('c:type', 'FILE'), + ('c:type', '_Bool'), + ('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', 'COLS'), + ('envvar', 'COLUMNS'), + ('envvar', 'COMSPEC'), + ('envvar', 'DISPLAY'), + ('envvar', 'HOME'), + ('envvar', 'HOMEDRIVE'), + ('envvar', 'HOMEPATH'), + ('envvar', 'IDLESTARTUP'), + ('envvar', 'LANG'), + ('envvar', 'LANGUAGE'), + ('envvar', 'LC_ALL'), + ('envvar', 'LC_MESSAGES'), + ('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. 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 index 00000000000000..42b6348153b56a --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-07-21-11-51-57.gh-issue-106948.K_JQ7j.rst @@ -0,0 +1 @@ +Add a number of standard external names to ``nitpick_ignore``. From 1f10607e2041c066b4f710cd5ecea1112d3e3642 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 21 Jul 2023 12:11:04 +0300 Subject: [PATCH 2/9] REmove some `!`s. --- Doc/library/os.rst | 2 +- Doc/library/venv.rst | 6 +++--- Doc/library/webbrowser.rst | 6 +++--- Doc/whatsnew/3.12.rst | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index b35010498f2143..40c7b61a5e6fe0 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -4650,7 +4650,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) diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst index 9e5672545dea35..2482441d649790 100644 --- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -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:`#!/{}/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. diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index b6762f78830a5f..4667b81e38ada2 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -20,7 +20,7 @@ will be used if graphical browsers are not available or an X11 display isn't available. If text-mode browsers are used, the calling process will block until the user exits the browser. -If the environment variable :envvar:`!BROWSER` exists, it is interpreted as the +If the environment variable :envvar:`BROWSER` exists, it is interpreted as the :data:`os.pathsep`-separated list of browsers to try ahead of the platform defaults. When the value of a list part contains the string ``%s``, then it is interpreted as a literal browser command line to be used with the argument URL @@ -97,7 +97,7 @@ The following functions are defined: Setting *preferred* to ``True`` makes this browser a preferred result for a :func:`get` call with no argument. Otherwise, this entry point is only - useful if you plan to either set the :envvar:`!BROWSER` variable or call + useful if you plan to either set the :envvar:`BROWSER` variable or call :func:`get` with a nonempty argument matching the name of a handler you declare. @@ -224,4 +224,4 @@ module-level convenience functions: .. rubric:: Footnotes .. [1] Executables named here without a full path will be searched in the - directories given in the :envvar:`!PATH` environment variable. + directories given in the :envvar:`PATH` environment variable. diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index b3b9b4134a9bb0..4ff716d26cbc07 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1769,7 +1769,7 @@ Porting to Python 3.12 for example). * Add support of more formatting options (left aligning, octals, uppercase - hexadecimals, ``intmax_t``, ``ptrdiff_t``, ``wchar_t`` C + hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:`98836`.) From 06eec6ae3f1e274ade66264fa59be358b62ff505 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 12:45:47 +0300 Subject: [PATCH 3/9] Use :c:type: role. --- Doc/c-api/arg.rst | 2 +- Doc/c-api/memory.rst | 2 +- Doc/c-api/unicode.rst | 22 +++++++++---------- Doc/c-api/veryhigh.rst | 2 +- Doc/library/array.rst | 4 ++-- Doc/library/ctypes.rst | 16 +++++++------- Doc/library/struct.rst | 8 +++---- Doc/whatsnew/2.6.rst | 2 +- Doc/whatsnew/3.13.rst | 10 ++++----- Doc/whatsnew/3.3.rst | 2 +- Doc/whatsnew/3.5.rst | 2 +- Doc/whatsnew/3.9.rst | 4 ++-- Misc/NEWS.d/3.10.0a5.rst | 2 +- Misc/NEWS.d/3.12.0a1.rst | 2 +- Misc/NEWS.d/3.12.0b1.rst | 2 +- ...-05-31-18-37-57.gh-issue-105156.R4El5V.rst | 4 ++-- 16 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index e8d141f1739331..9d744a12e374be 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -555,7 +555,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. diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index 35c356f25c6c70..4ca3b8804427f8 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -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 diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index beb4f42a208fa2..cf97b11bdbbf41 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -44,7 +44,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 @@ -437,11 +437,11 @@ APIs: +----------+-----------------------------------------------------+ | ``ll`` | :c:expr:`long long` or :c:expr:`unsigned long long` | +----------+-----------------------------------------------------+ - | ``j`` | :c:expr:`intmax_t` or :c:expr:`uintmax_t` | + | ``j`` | :c:type:`intmax_t` or :c:type:`uintmax_t` | +----------+-----------------------------------------------------+ - | ``z`` | :c:expr:`size_t` or :c:expr:`ssize_t` | + | ``z`` | :c:type:`size_t` or :c:type:`ssize_t` | +----------+-----------------------------------------------------+ - | ``t`` | :c:expr:`ptrdiff_t` | + | ``t`` | :c:type:`ptrdiff_t` | +----------+-----------------------------------------------------+ The length modifier ``l`` for following conversions ``s`` or ``V`` specify @@ -520,7 +520,7 @@ APIs: .. note:: The width formatter unit is number of characters rather than bytes. - The precision formatter unit is number of bytes or :c:expr:`wchar_t` + The precision formatter unit is number of bytes or :c:type:`wchar_t` items (if the length modifier ``l`` is used) for ``"%s"`` and ``"%V"`` (if the ``PyObject*`` argument is ``NULL``), and a number of characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"`` @@ -839,11 +839,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. @@ -851,9 +851,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 @@ -867,7 +867,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. diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst index 1e8a945512d78c..56fa2d6abd9139 100644 --- a/Doc/c-api/veryhigh.rst +++ b/Doc/c-api/veryhigh.rst @@ -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 diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 0afc217642a756..ad622627724217 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -53,9 +53,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 3.16 Please migrate to ``'w'`` typecode. diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 81509c0920bb6e..da871726f4f2ea 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -216,11 +216,11 @@ Fundamental data types +----------------------+------------------------------------------+----------------------------+ | ctypes type | C type | Python type | +======================+==========================================+============================+ -| :class:`c_bool` | :c:expr:`_Bool` | bool (1) | +| :class:`c_bool` | :c:type:`_Bool` | bool (1) | +----------------------+------------------------------------------+----------------------------+ | :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 | +----------------------+------------------------------------------+----------------------------+ @@ -243,9 +243,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_time_t` | :c:type:`time_t` | int | @@ -335,7 +335,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. @@ -478,7 +478,7 @@ By default functions are assumed to return the C :c:expr:`int` type. Other return types can be specified by setting the :attr:`restype` attribute of the function object. -The C prototype of ``time()`` is ``time_t time(time_t *)``. Because ``time_t`` +The C prototype of ``time()`` is ``time_t time(time_t *)``. Because :c:type:`time_t` might be of a different type than the default return type ``int``, you should specify the ``restype``:: @@ -2407,7 +2407,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. @@ -2421,7 +2421,7 @@ These are the fundamental ctypes data types: .. class:: c_bool - Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` from + Represent the C :c:expr:`bool` datatype (more accurately, :c:type:`_Bool` from C99). Its value can be ``True`` or ``False``, and the constructor accepts any object that has a truth value. diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 6d2739b4557fbf..73d66c4842b41b 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -212,7 +212,7 @@ platform-dependent. +--------+--------------------------+--------------------+----------------+------------+ | ``B`` | :c:expr:`unsigned char` | integer | 1 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ -| ``?`` | :c:expr:`_Bool` | bool | 1 | \(1) | +| ``?`` | :c:type:`_Bool` | bool | 1 | \(1) | +--------+--------------------------+--------------------+----------------+------------+ | ``h`` | :c:expr:`short` | integer | 2 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ @@ -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) | +--------+--------------------------+--------------------+----------------+------------+ @@ -260,7 +260,7 @@ Notes: (1) .. index:: single: ? (question mark); in struct format strings - The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined by + The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by C99. If this type is not available, it is simulated using a :c:expr:`char`. In standard mode, it is always represented by one byte. diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index fb56690ce25117..08ed09bc0106a2 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2389,7 +2389,7 @@ changes, or look through the Subversion logs for all the details. has been updated from version 2.3.2 in Python 2.5 to version 2.4.1. -* The :mod:`struct` module now supports the C99 :c:expr:`_Bool` type, +* The :mod:`struct` module now supports the C99 :c:type:`_Bool` type, using the format character ``'?'``. (Contributed by David Remahl.) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 1d5e34dac28a51..87238c575fa3e9 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -327,7 +327,7 @@ Pending Removal in Python 3.15 Pending Removal in Python 3.16 ------------------------------ -* :class:`array.array` ``'u'`` type (``wchar_t``): +* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the ``'w'`` type instead (``Py_UCS4``). Pending Removal in Future Versions @@ -793,8 +793,8 @@ Deprecated ---------- * Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly - the ``wchar_t`` type instead. Since Python 3.3, ``Py_UNICODE`` and - ``PY_UNICODE_TYPE`` are just aliases to ``wchar_t``. + the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and + ``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`. (Contributed by Victor Stinner in :gh:`105156`.) * Deprecate old Python initialization functions: @@ -997,8 +997,8 @@ Pending Removal in Python 3.15 * :c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`. * :c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead. * :c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead. -* :c:type:`!Py_UNICODE_WIDE` type: use ``wchar_t`` instead. -* :c:type:`Py_UNICODE` type: use ``wchar_t`` instead. +* :c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead. +* :c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead. * Python initialization functions: * :c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst index 3dca7227a91c38..1b0276b343562c 100644 --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -1984,7 +1984,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`.) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index ccf71bf08e8608..9b2acfa8cd2b58 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -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. diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index d1e7efa0799219..cb5f872b068eb2 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -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 diff --git a/Misc/NEWS.d/3.10.0a5.rst b/Misc/NEWS.d/3.10.0a5.rst index 497e3849171831..dc95e8ce072fd9 100644 --- a/Misc/NEWS.d/3.10.0a5.rst +++ b/Misc/NEWS.d/3.10.0a5.rst @@ -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/3.12.0a1.rst b/Misc/NEWS.d/3.12.0a1.rst index 0609270c6805bf..fd22d26c46f63e 100644 --- a/Misc/NEWS.d/3.12.0a1.rst +++ b/Misc/NEWS.d/3.12.0a1.rst @@ -5308,7 +5308,7 @@ parameter. Patch by Kumar Aditya. .. section: Build Python now always use the ``%zu`` and ``%zd`` printf formats to format a -``size_t`` or ``Py_ssize_t`` number. Building Python 3.12 requires a C11 +:c:type:`size_t` or ``Py_ssize_t`` number. Building Python 3.12 requires a C11 compiler, so these printf formats are now always supported. Patch by Victor Stinner. diff --git a/Misc/NEWS.d/3.12.0b1.rst b/Misc/NEWS.d/3.12.0b1.rst index 7be70de029b1f5..274ea18224c7b9 100644 --- a/Misc/NEWS.d/3.12.0b1.rst +++ b/Misc/NEWS.d/3.12.0b1.rst @@ -2382,7 +2382,7 @@ Patch by Dong-hee Na. .. section: C API Add support of more formatting options (left aligning, octals, uppercase -hexadecimals, :c:expr:`intmax_t`, :c:expr:`ptrdiff_t`, :c:expr:`wchar_t` C +hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` and :c:func:`PyUnicode_FromFormatV`. diff --git a/Misc/NEWS.d/next/C API/2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst b/Misc/NEWS.d/next/C API/2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst index cbdb8379f24ccd..536e484116690d 100644 --- a/Misc/NEWS.d/next/C API/2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst +++ b/Misc/NEWS.d/next/C API/2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst @@ -1,4 +1,4 @@ Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly -the ``wchar_t`` type instead. Since Python 3.3, ``Py_UNICODE`` and -``PY_UNICODE_TYPE`` are just aliases to ``wchar_t``. Patch by Victor +the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and +``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`. Patch by Victor Stinner. From 31488dc92a61d0d31b8e399efcc3b494c4a6049b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 16:05:49 +0300 Subject: [PATCH 4/9] Reduce Doc/library/importlib.rst. --- Doc/tools/.nitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index 23aa30c956b3bd..f02fbd43e6f15a 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -96,7 +96,6 @@ Doc/library/codecs.rst Doc/library/codeop.rst Doc/library/collections.abc.rst Doc/library/collections.rst -Doc/library/compileall.rst Doc/library/concurrent.futures.rst Doc/library/concurrent.rst Doc/library/configparser.rst @@ -106,7 +105,6 @@ Doc/library/copy.rst Doc/library/csv.rst Doc/library/ctypes.rst Doc/library/curses.ascii.rst -Doc/library/curses.rst Doc/library/datetime.rst Doc/library/dbm.rst Doc/library/decimal.rst @@ -144,7 +142,6 @@ Doc/library/http.client.rst Doc/library/http.cookiejar.rst Doc/library/http.cookies.rst Doc/library/http.server.rst -Doc/library/idle.rst Doc/library/importlib.resources.abc.rst Doc/library/importlib.resources.rst Doc/library/importlib.rst @@ -172,11 +169,9 @@ Doc/library/pickletools.rst Doc/library/platform.rst Doc/library/plistlib.rst Doc/library/poplib.rst -Doc/library/posix.rst Doc/library/pprint.rst Doc/library/profile.rst Doc/library/pty.rst -Doc/library/py_compile.rst Doc/library/pyclbr.rst Doc/library/pydoc.rst Doc/library/pyexpat.rst @@ -262,7 +257,6 @@ Doc/tutorial/modules.rst Doc/tutorial/stdlib2.rst Doc/using/cmdline.rst Doc/using/configure.rst -Doc/using/unix.rst Doc/using/windows.rst Doc/whatsnew/2.0.rst Doc/whatsnew/2.1.rst From dc6d2c822c5c2d4cb8735f7cb605bbf219c7ed33 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 16:09:36 +0300 Subject: [PATCH 5/9] _Bool is a keyword. --- Doc/conf.py | 1 - Doc/library/ctypes.rst | 4 ++-- Doc/library/struct.rst | 4 ++-- Doc/whatsnew/2.6.rst | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 3f2db4c8c96c53..d7ea336281e3e5 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -79,7 +79,6 @@ nitpick_ignore = [ # Standard C types ('c:type', 'FILE'), - ('c:type', '_Bool'), ('c:type', '__int'), ('c:type', 'intmax_t'), ('c:type', 'off_t'), diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index da871726f4f2ea..08a52df19e2644 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -216,7 +216,7 @@ Fundamental data types +----------------------+------------------------------------------+----------------------------+ | ctypes type | C type | Python type | +======================+==========================================+============================+ -| :class:`c_bool` | :c:type:`_Bool` | bool (1) | +| :class:`c_bool` | :c:texpr:`_Bool` | bool (1) | +----------------------+------------------------------------------+----------------------------+ | :class:`c_char` | :c:expr:`char` | 1-character bytes object | +----------------------+------------------------------------------+----------------------------+ @@ -2421,7 +2421,7 @@ These are the fundamental ctypes data types: .. class:: c_bool - Represent the C :c:expr:`bool` datatype (more accurately, :c:type:`_Bool` from + Represent the C :c:texpr:`bool` datatype (more accurately, :c:texpr:`_Bool` from C99). Its value can be ``True`` or ``False``, and the constructor accepts any object that has a truth value. diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 73d66c4842b41b..fac181da55b51b 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -212,7 +212,7 @@ platform-dependent. +--------+--------------------------+--------------------+----------------+------------+ | ``B`` | :c:expr:`unsigned char` | integer | 1 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ -| ``?`` | :c:type:`_Bool` | bool | 1 | \(1) | +| ``?`` | :c:texpr:`_Bool` | bool | 1 | \(1) | +--------+--------------------------+--------------------+----------------+------------+ | ``h`` | :c:expr:`short` | integer | 2 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ @@ -260,7 +260,7 @@ Notes: (1) .. index:: single: ? (question mark); in struct format strings - The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by + The ``'?'`` conversion code corresponds to the :c:texpr:`_Bool` type defined by C99. If this type is not available, it is simulated using a :c:expr:`char`. In standard mode, it is always represented by one byte. diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 08ed09bc0106a2..96683da56d9d11 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2389,7 +2389,7 @@ changes, or look through the Subversion logs for all the details. has been updated from version 2.3.2 in Python 2.5 to version 2.4.1. -* The :mod:`struct` module now supports the C99 :c:type:`_Bool` type, +* The :mod:`struct` module now supports the C99 :c:texpr:`_Bool` type, using the format character ``'?'``. (Contributed by David Remahl.) From 941ba8cb05bd8353cf502139d5d164eccb8d040b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 16:58:45 +0300 Subject: [PATCH 6/9] Reduce Doc/tools/.nitignore. --- Doc/tools/.nitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index becca778228fd2..6f957c5d0d5d0a 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -188,7 +188,6 @@ Doc/library/ssl.rst Doc/library/stat.rst Doc/library/stdtypes.rst Doc/library/string.rst -Doc/library/struct.rst Doc/library/subprocess.rst Doc/library/sys.rst Doc/library/sys_path_init.rst From 7fe195ce2b46373da3ce54bc622bfc4c5dedd471 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 18:21:59 +0300 Subject: [PATCH 7/9] Add other locale envvars. --- Doc/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/conf.py b/Doc/conf.py index d7ea336281e3e5..52bb9459901b4d 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -110,7 +110,12 @@ ('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'), From 60cfe622ec007a03b5cfded1d347c62db97adc80 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 18:23:38 +0300 Subject: [PATCH 8/9] COLS is not an envvar. --- Doc/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index 52bb9459901b4d..bd01850589b273 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -99,7 +99,6 @@ ('c:data', 'errno'), # Standard environment variables ('envvar', 'BROWSER'), - ('envvar', 'COLS'), ('envvar', 'COLUMNS'), ('envvar', 'COMSPEC'), ('envvar', 'DISPLAY'), From ec12ccb9269c945d5091c83dd51386d831ab2429 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Jul 2023 20:30:26 +0300 Subject: [PATCH 9/9] Revert :c:texpr: to :c:expr:. --- Doc/library/ctypes.rst | 4 ++-- Doc/library/struct.rst | 4 ++-- Doc/whatsnew/2.6.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 08a52df19e2644..c253a45e1a8b54 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -216,7 +216,7 @@ Fundamental data types +----------------------+------------------------------------------+----------------------------+ | ctypes type | C type | Python type | +======================+==========================================+============================+ -| :class:`c_bool` | :c:texpr:`_Bool` | bool (1) | +| :class:`c_bool` | :c:expr:`_Bool` | bool (1) | +----------------------+------------------------------------------+----------------------------+ | :class:`c_char` | :c:expr:`char` | 1-character bytes object | +----------------------+------------------------------------------+----------------------------+ @@ -2421,7 +2421,7 @@ These are the fundamental ctypes data types: .. class:: c_bool - Represent the C :c:texpr:`bool` datatype (more accurately, :c:texpr:`_Bool` from + Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` from C99). Its value can be ``True`` or ``False``, and the constructor accepts any object that has a truth value. diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index fac181da55b51b..c94dfde4d55763 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -212,7 +212,7 @@ platform-dependent. +--------+--------------------------+--------------------+----------------+------------+ | ``B`` | :c:expr:`unsigned char` | integer | 1 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ -| ``?`` | :c:texpr:`_Bool` | bool | 1 | \(1) | +| ``?`` | :c:expr:`_Bool` | bool | 1 | \(1) | +--------+--------------------------+--------------------+----------------+------------+ | ``h`` | :c:expr:`short` | integer | 2 | \(2) | +--------+--------------------------+--------------------+----------------+------------+ @@ -260,7 +260,7 @@ Notes: (1) .. index:: single: ? (question mark); in struct format strings - The ``'?'`` conversion code corresponds to the :c:texpr:`_Bool` type defined by + The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined by C99. If this type is not available, it is simulated using a :c:expr:`char`. In standard mode, it is always represented by one byte. diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 96683da56d9d11..fb56690ce25117 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2389,7 +2389,7 @@ changes, or look through the Subversion logs for all the details. has been updated from version 2.3.2 in Python 2.5 to version 2.4.1. -* The :mod:`struct` module now supports the C99 :c:texpr:`_Bool` type, +* The :mod:`struct` module now supports the C99 :c:expr:`_Bool` type, using the format character ``'?'``. (Contributed by David Remahl.)