Skip to content

Commit ec8718d

Browse files
[3.11] gh-106948: Add standard external names to nitpick_ignore (GH-106949) (#107061)
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 f8b7fe2)
1 parent 65e40aa commit ec8718d

15 files changed

+81
-28
lines changed

Doc/c-api/arg.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ Building values
584584
Same as ``s#``.
585585
586586
``u`` (:class:`str`) [const wchar_t \*]
587-
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
587+
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
588588
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
589589
``None`` is returned.
590590

Doc/c-api/memory.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ that the treatment of negative indices differs from a Python slice):
581581
default).
582582
583583
A serial number, incremented by 1 on each call to a malloc-like or
584-
realloc-like function. Big-endian ``size_t``. If "bad memory" is detected
584+
realloc-like function. Big-endian :c:type:`size_t`. If "bad memory" is detected
585585
later, the serial number gives an excellent way to set a breakpoint on the
586586
next run, to capture the instant at which this block was passed out. The
587587
static function bumpserialno() in obmalloc.c is the only place the serial

Doc/c-api/unicode.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Python:
5858

5959
.. c:type:: Py_UNICODE
6060
61-
This is a typedef of :c:expr:`wchar_t`, which is a 16-bit type or 32-bit type
61+
This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type
6262
depending on the platform.
6363

6464
.. versionchanged:: 3.3
@@ -935,21 +935,21 @@ conversion function:
935935
wchar_t Support
936936
"""""""""""""""
937937
938-
:c:expr:`wchar_t` support for platforms which support it:
938+
:c:type:`wchar_t` support for platforms which support it:
939939
940940
.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
941941
942-
Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given *size*.
942+
Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
943943
Passing ``-1`` as the *size* indicates that the function must itself compute the length,
944944
using wcslen.
945945
Return ``NULL`` on failure.
946946
947947
948948
.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
949949
950-
Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*. At most
951-
*size* :c:expr:`wchar_t` characters are copied (excluding a possibly trailing
952-
null termination character). Return the number of :c:expr:`wchar_t` characters
950+
Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*. At most
951+
*size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
952+
null termination character). Return the number of :c:type:`wchar_t` characters
953953
copied or ``-1`` in case of an error. Note that the resulting :c:expr:`wchar_t*`
954954
string may or may not be null-terminated. It is the responsibility of the caller
955955
to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
@@ -963,7 +963,7 @@ wchar_t Support
963963
Convert the Unicode object to a wide character string. The output string
964964
always ends with a null character. If *size* is not ``NULL``, write the number
965965
of wide characters (excluding the trailing null termination character) into
966-
*\*size*. Note that the resulting :c:expr:`wchar_t` string might contain
966+
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
967967
null characters, which would cause the string to be truncated when used with
968968
most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string
969969
contains null characters a :exc:`ValueError` is raised.

Doc/c-api/veryhigh.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ parameter. The available start symbols are :c:data:`Py_eval_input`,
1717
following the functions which accept them as parameters.
1818

1919
Note also that several of these functions take :c:expr:`FILE*` parameters. One
20-
particular issue which needs to be handled carefully is that the :c:expr:`FILE`
20+
particular issue which needs to be handled carefully is that the :c:type:`FILE`
2121
structure for different C libraries can be different and incompatible. Under
2222
Windows (at least), it is possible for dynamically linked extensions to actually
2323
use different libraries, so care should be taken that :c:expr:`FILE*` parameters

Doc/conf.py

+52
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,58 @@
7272
exclude_patterns.append(venvdir + '/*')
7373

7474
nitpick_ignore = [
75+
# Standard C types
76+
('c:type', 'FILE'),
77+
('c:type', '__int'),
78+
('c:type', 'intmax_t'),
79+
('c:type', 'off_t'),
80+
('c:type', 'ptrdiff_t'),
81+
('c:type', 'siginfo_t'),
82+
('c:type', 'size_t'),
83+
('c:type', 'ssize_t'),
84+
('c:type', 'time_t'),
85+
('c:type', 'uintmax_t'),
86+
('c:type', 'va_list'),
87+
('c:type', 'wchar_t'),
88+
# Standard C macros
89+
('c:macro', 'LLONG_MAX'),
90+
('c:macro', 'LLONG_MIN'),
91+
('c:macro', 'LONG_MAX'),
92+
('c:macro', 'LONG_MIN'),
93+
# Standard C variables
94+
('c:data', 'errno'),
95+
# Standard environment variables
96+
('envvar', 'BROWSER'),
97+
('envvar', 'COLUMNS'),
98+
('envvar', 'COMSPEC'),
99+
('envvar', 'DISPLAY'),
100+
('envvar', 'HOME'),
101+
('envvar', 'HOMEDRIVE'),
102+
('envvar', 'HOMEPATH'),
103+
('envvar', 'IDLESTARTUP'),
104+
('envvar', 'LANG'),
105+
('envvar', 'LANGUAGE'),
106+
('envvar', 'LC_ALL'),
107+
('envvar', 'LC_CTYPE'),
108+
('envvar', 'LC_COLLATE'),
109+
('envvar', 'LC_MESSAGES'),
110+
('envvar', 'LC_MONETARY'),
111+
('envvar', 'LC_NUMERIC'),
112+
('envvar', 'LC_TIME'),
113+
('envvar', 'LINES'),
114+
('envvar', 'LOGNAME'),
115+
('envvar', 'PAGER'),
116+
('envvar', 'PATH'),
117+
('envvar', 'PATHEXT'),
118+
('envvar', 'SOURCE_DATE_EPOCH'),
119+
('envvar', 'TEMP'),
120+
('envvar', 'TERM'),
121+
('envvar', 'TMP'),
122+
('envvar', 'TMPDIR'),
123+
('envvar', 'TZ'),
124+
('envvar', 'USER'),
125+
('envvar', 'USERNAME'),
126+
('envvar', 'USERPROFILE'),
75127
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
76128
# be resolved, as the method is currently undocumented. For context, see
77129
# https://github.com/python/cpython/pull/103289.

Doc/library/array.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Notes:
5151
It can be 16 bits or 32 bits depending on the platform.
5252

5353
.. versionchanged:: 3.9
54-
``array('u')`` now uses ``wchar_t`` as C type instead of deprecated
54+
``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated
5555
``Py_UNICODE``. This change doesn't affect its behavior because
56-
``Py_UNICODE`` is alias of ``wchar_t`` since Python 3.3.
56+
``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3.
5757

5858
.. deprecated-removed:: 3.3 4.0
5959

Doc/library/ctypes.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Fundamental data types
221221
+----------------------+------------------------------------------+----------------------------+
222222
| :class:`c_char` | :c:expr:`char` | 1-character bytes object |
223223
+----------------------+------------------------------------------+----------------------------+
224-
| :class:`c_wchar` | :c:expr:`wchar_t` | 1-character string |
224+
| :class:`c_wchar` | :c:type:`wchar_t` | 1-character string |
225225
+----------------------+------------------------------------------+----------------------------+
226226
| :class:`c_byte` | :c:expr:`char` | int |
227227
+----------------------+------------------------------------------+----------------------------+
@@ -244,9 +244,9 @@ Fundamental data types
244244
| :class:`c_ulonglong` | :c:expr:`unsigned __int64` or | int |
245245
| | :c:expr:`unsigned long long` | |
246246
+----------------------+------------------------------------------+----------------------------+
247-
| :class:`c_size_t` | :c:expr:`size_t` | int |
247+
| :class:`c_size_t` | :c:type:`size_t` | int |
248248
+----------------------+------------------------------------------+----------------------------+
249-
| :class:`c_ssize_t` | :c:expr:`ssize_t` or | int |
249+
| :class:`c_ssize_t` | :c:type:`ssize_t` or | int |
250250
| | :c:expr:`Py_ssize_t` | |
251251
+----------------------+------------------------------------------+----------------------------+
252252
| :class:`c_float` | :c:expr:`float` | float |
@@ -334,7 +334,7 @@ property::
334334

335335
The :func:`create_string_buffer` function replaces the old :func:`c_buffer`
336336
function (which is still available as an alias). To create a mutable memory
337-
block containing unicode characters of the C type :c:expr:`wchar_t`, use the
337+
block containing unicode characters of the C type :c:type:`wchar_t`, use the
338338
:func:`create_unicode_buffer` function.
339339

340340

@@ -2361,7 +2361,7 @@ These are the fundamental ctypes data types:
23612361

23622362
.. class:: c_wchar
23632363

2364-
Represents the C :c:expr:`wchar_t` datatype, and interprets the value as a
2364+
Represents the C :c:type:`wchar_t` datatype, and interprets the value as a
23652365
single character unicode string. The constructor accepts an optional string
23662366
initializer, the length of the string must be exactly one character.
23672367

Doc/library/os.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4410,7 +4410,7 @@ written in Python, such as a mail server's external command delivery program.
44104410
:data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags.
44114411

44124412
The return value is an object representing the data contained in the
4413-
:c:type:`!siginfo_t` structure with the following attributes:
4413+
:c:type:`siginfo_t` structure with the following attributes:
44144414

44154415
* :attr:`!si_pid` (process ID)
44164416
* :attr:`!si_uid` (real user ID of the child)

Doc/library/struct.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ platform-dependent.
231231
| ``Q`` | :c:expr:`unsigned long | integer | 8 | \(2) |
232232
| | long` | | | |
233233
+--------+--------------------------+--------------------+----------------+------------+
234-
| ``n`` | :c:expr:`ssize_t` | integer | | \(3) |
234+
| ``n`` | :c:type:`ssize_t` | integer | | \(3) |
235235
+--------+--------------------------+--------------------+----------------+------------+
236-
| ``N`` | :c:expr:`size_t` | integer | | \(3) |
236+
| ``N`` | :c:type:`size_t` | integer | | \(3) |
237237
+--------+--------------------------+--------------------+----------------+------------+
238238
| ``e`` | \(6) | float | 2 | \(4) |
239239
+--------+--------------------------+--------------------+----------------+------------+

Doc/library/venv.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ running from a virtual environment.
6060

6161
A virtual environment may be "activated" using a script in its binary directory
6262
(``bin`` on POSIX; ``Scripts`` on Windows).
63-
This will prepend that directory to your :envvar:`!PATH`, so that running
63+
This will prepend that directory to your :envvar:`PATH`, so that running
6464
:program:`python` will invoke the environment's Python interpreter
6565
and you can run installed scripts without having to use their full path.
6666
The invocation of the activation script is platform-specific
@@ -100,10 +100,10 @@ In order to achieve this, scripts installed into virtual environments have
100100
a "shebang" line which points to the environment's Python interpreter,
101101
i.e. :samp:`#!/{<path-to-venv>}/bin/python`.
102102
This means that the script will run with that interpreter regardless of the
103-
value of :envvar:`!PATH`. On Windows, "shebang" line processing is supported if
103+
value of :envvar:`PATH`. On Windows, "shebang" line processing is supported if
104104
you have the :ref:`launcher` installed. Thus, double-clicking an installed
105105
script in a Windows Explorer window should run it with the correct interpreter
106-
without the environment needing to be activated or on the :envvar:`!PATH`.
106+
without the environment needing to be activated or on the :envvar:`PATH`.
107107

108108
When a virtual environment has been activated, the :envvar:`!VIRTUAL_ENV`
109109
environment variable is set to the path of the environment.

Doc/whatsnew/3.3.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ the form '-rwxrwxrwx'.
19831983
struct
19841984
------
19851985

1986-
The :mod:`struct` module now supports ``ssize_t`` and ``size_t`` via the
1986+
The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` via the
19871987
new codes ``n`` and ``N``, respectively. (Contributed by Antoine Pitrou
19881988
in :issue:`3163`.)
19891989

Doc/whatsnew/3.5.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ encode error with ``\N{...}`` escapes.
21922192
(Contributed by Serhiy Storchaka in :issue:`19676`.)
21932193

21942194
A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`,
2195-
but accepts a ``va_list`` argument.
2195+
but accepts a :c:type:`va_list` argument.
21962196
(Contributed by Antoine Pitrou in :issue:`18711`.)
21972197

21982198
A new :c:data:`PyExc_RecursionError` exception.

Doc/whatsnew/3.9.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1115,9 +1115,9 @@ Changes in the Python API
11151115
``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
11161116
(Contributed by Batuhan Taskaya in :issue:`39562`)
11171117

1118-
* ``array('u')`` now uses ``wchar_t`` as C type instead of ``Py_UNICODE``.
1118+
* ``array('u')`` now uses :c:type:`wchar_t` as C type instead of ``Py_UNICODE``.
11191119
This change doesn't affect to its behavior because ``Py_UNICODE`` is alias
1120-
of ``wchar_t`` since Python 3.3.
1120+
of :c:type:`wchar_t` since Python 3.3.
11211121
(Contributed by Inada Naoki in :issue:`34538`.)
11221122

11231123
* The :func:`logging.getLogger` API now returns the root logger when passed

Misc/NEWS.d/3.10.0a5.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,4 +667,4 @@ exception (if an exception is set). Patch by Victor Stinner.
667667
.. section: C API
668668
669669
Fixed a compiler warning in :c:func:`Py_UNICODE_ISSPACE()` on platforms with
670-
signed ``wchar_t``.
670+
signed :c:type:`wchar_t`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a number of standard external names to ``nitpick_ignore``.

0 commit comments

Comments
 (0)