Skip to content

Commit f8b7fe2

Browse files
gh-106948: Add standard external names to nitpick_ignore (GH-106949)
It includes standard C types, macros and variables like "size_t", "LONG_MAX" and "errno", and standard environment variables like "PATH".
1 parent 26e08df commit f8b7fe2

22 files changed

+99
-53
lines changed

Doc/c-api/arg.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ Building values
555555
Same as ``s#``.
556556
557557
``u`` (:class:`str`) [const wchar_t \*]
558-
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
558+
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
559559
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
560560
``None`` is returned.
561561

Doc/c-api/memory.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Python:
4444

4545
.. c:type:: Py_UNICODE
4646
47-
This is a typedef of :c:expr:`wchar_t`, which is a 16-bit type or 32-bit type
47+
This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type
4848
depending on the platform.
4949

5050
.. versionchanged:: 3.3
@@ -437,11 +437,11 @@ APIs:
437437
+----------+-----------------------------------------------------+
438438
| ``ll`` | :c:expr:`long long` or :c:expr:`unsigned long long` |
439439
+----------+-----------------------------------------------------+
440-
| ``j`` | :c:expr:`intmax_t` or :c:expr:`uintmax_t` |
440+
| ``j`` | :c:type:`intmax_t` or :c:type:`uintmax_t` |
441441
+----------+-----------------------------------------------------+
442-
| ``z`` | :c:expr:`size_t` or :c:expr:`ssize_t` |
442+
| ``z`` | :c:type:`size_t` or :c:type:`ssize_t` |
443443
+----------+-----------------------------------------------------+
444-
| ``t`` | :c:expr:`ptrdiff_t` |
444+
| ``t`` | :c:type:`ptrdiff_t` |
445445
+----------+-----------------------------------------------------+
446446
447447
The length modifier ``l`` for following conversions ``s`` or ``V`` specify
@@ -520,7 +520,7 @@ APIs:
520520
521521
.. note::
522522
The width formatter unit is number of characters rather than bytes.
523-
The precision formatter unit is number of bytes or :c:expr:`wchar_t`
523+
The precision formatter unit is number of bytes or :c:type:`wchar_t`
524524
items (if the length modifier ``l`` is used) for ``"%s"`` and
525525
``"%V"`` (if the ``PyObject*`` argument is ``NULL``), and a number of
526526
characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"``
@@ -839,21 +839,21 @@ conversion function:
839839
wchar_t Support
840840
"""""""""""""""
841841
842-
:c:expr:`wchar_t` support for platforms which support it:
842+
:c:type:`wchar_t` support for platforms which support it:
843843
844844
.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
845845
846-
Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given *size*.
846+
Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
847847
Passing ``-1`` as the *size* indicates that the function must itself compute the length,
848848
using wcslen.
849849
Return ``NULL`` on failure.
850850
851851
852852
.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
853853
854-
Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*. At most
855-
*size* :c:expr:`wchar_t` characters are copied (excluding a possibly trailing
856-
null termination character). Return the number of :c:expr:`wchar_t` characters
854+
Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*. At most
855+
*size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
856+
null termination character). Return the number of :c:type:`wchar_t` characters
857857
copied or ``-1`` in case of an error. Note that the resulting :c:expr:`wchar_t*`
858858
string may or may not be null-terminated. It is the responsibility of the caller
859859
to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
@@ -867,7 +867,7 @@ wchar_t Support
867867
Convert the Unicode object to a wide character string. The output string
868868
always ends with a null character. If *size* is not ``NULL``, write the number
869869
of wide characters (excluding the trailing null termination character) into
870-
*\*size*. Note that the resulting :c:expr:`wchar_t` string might contain
870+
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
871871
null characters, which would cause the string to be truncated when used with
872872
most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string
873873
contains null characters a :exc:`ValueError` is raised.

Doc/c-api/veryhigh.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,58 @@
7777
exclude_patterns.append(venvdir + '/*')
7878

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

Doc/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ Notes:
5353
It can be 16 bits or 32 bits depending on the platform.
5454

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

6060
.. deprecated-removed:: 3.3 3.16
6161
Please migrate to ``'w'`` typecode.

Doc/library/ctypes.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Fundamental data types
220220
+----------------------+------------------------------------------+----------------------------+
221221
| :class:`c_char` | :c:expr:`char` | 1-character bytes object |
222222
+----------------------+------------------------------------------+----------------------------+
223-
| :class:`c_wchar` | :c:expr:`wchar_t` | 1-character string |
223+
| :class:`c_wchar` | :c:type:`wchar_t` | 1-character string |
224224
+----------------------+------------------------------------------+----------------------------+
225225
| :class:`c_byte` | :c:expr:`char` | int |
226226
+----------------------+------------------------------------------+----------------------------+
@@ -243,9 +243,9 @@ Fundamental data types
243243
| :class:`c_ulonglong` | :c:expr:`unsigned __int64` or | int |
244244
| | :c:expr:`unsigned long long` | |
245245
+----------------------+------------------------------------------+----------------------------+
246-
| :class:`c_size_t` | :c:expr:`size_t` | int |
246+
| :class:`c_size_t` | :c:type:`size_t` | int |
247247
+----------------------+------------------------------------------+----------------------------+
248-
| :class:`c_ssize_t` | :c:expr:`ssize_t` or | int |
248+
| :class:`c_ssize_t` | :c:type:`ssize_t` or | int |
249249
| | :c:expr:`Py_ssize_t` | |
250250
+----------------------+------------------------------------------+----------------------------+
251251
| :class:`c_time_t` | :c:type:`time_t` | int |
@@ -335,7 +335,7 @@ property::
335335

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

341341

@@ -478,7 +478,7 @@ By default functions are assumed to return the C :c:expr:`int` type. Other
478478
return types can be specified by setting the :attr:`restype` attribute of the
479479
function object.
480480

481-
The C prototype of ``time()`` is ``time_t time(time_t *)``. Because ``time_t``
481+
The C prototype of ``time()`` is ``time_t time(time_t *)``. Because :c:type:`time_t`
482482
might be of a different type than the default return type ``int``, you should
483483
specify the ``restype``::
484484

@@ -2407,7 +2407,7 @@ These are the fundamental ctypes data types:
24072407

24082408
.. class:: c_wchar
24092409

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

Doc/library/os.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4650,7 +4650,7 @@ written in Python, such as a mail server's external command delivery program.
46504650
:data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags.
46514651

46524652
The return value is an object representing the data contained in the
4653-
:c:type:`!siginfo_t` structure with the following attributes:
4653+
:c:type:`siginfo_t` structure with the following attributes:
46544654

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

Doc/library/struct.rst

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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.

0 commit comments

Comments
 (0)