Skip to content

Commit 95e6108

Browse files
[3.12] pythongh-106948: Add standard external names to nitpick_ignore (pythonGH-106949)
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) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 0fff068 commit 95e6108

20 files changed

Lines changed: 93 additions & 44 deletions

‎Doc/c-api/arg.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ Building values
547547
Same as ``s#``.
548548
549549
``u`` (:class:`str`) [const wchar_t \*]
550-
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
550+
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
551551
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
552552
``None`` is returned.
553553

‎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
@@ -444,11 +444,11 @@ APIs:
444444
+----------+-----------------------------------------------------+
445445
| ``ll`` | :c:expr:`long long` or :c:expr:`unsigned long long` |
446446
+----------+-----------------------------------------------------+
447-
| ``j`` | :c:expr:`intmax_t` or :c:expr:`uintmax_t` |
447+
| ``j`` | :c:type:`intmax_t` or :c:type:`uintmax_t` |
448448
+----------+-----------------------------------------------------+
449-
| ``z`` | :c:expr:`size_t` or :c:expr:`ssize_t` |
449+
| ``z`` | :c:type:`size_t` or :c:type:`ssize_t` |
450450
+----------+-----------------------------------------------------+
451-
| ``t`` | :c:expr:`ptrdiff_t` |
451+
| ``t`` | :c:type:`ptrdiff_t` |
452452
+----------+-----------------------------------------------------+
453453
454454
The length modifier ``l`` for following conversions ``s`` or ``V`` specify
@@ -527,7 +527,7 @@ APIs:
527527
528528
.. note::
529529
The width formatter unit is number of characters rather than bytes.
530-
The precision formatter unit is number of bytes or :c:expr:`wchar_t`
530+
The precision formatter unit is number of bytes or :c:type:`wchar_t`
531531
items (if the length modifier ``l`` is used) for ``"%s"`` and
532532
``"%V"`` (if the ``PyObject*`` argument is ``NULL``), and a number of
533533
characters for ``"%A"``, ``"%U"``, ``"%S"``, ``"%R"`` and ``"%V"``
@@ -846,21 +846,21 @@ conversion function:
846846
wchar_t Support
847847
"""""""""""""""
848848
849-
:c:expr:`wchar_t` support for platforms which support it:
849+
:c:type:`wchar_t` support for platforms which support it:
850850
851851
.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
852852
853-
Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given *size*.
853+
Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
854854
Passing ``-1`` as the *size* indicates that the function must itself compute the length,
855855
using wcslen.
856856
Return ``NULL`` on failure.
857857
858858
859859
.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
860860
861-
Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*. At most
862-
*size* :c:expr:`wchar_t` characters are copied (excluding a possibly trailing
863-
null termination character). Return the number of :c:expr:`wchar_t` characters
861+
Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*. At most
862+
*size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
863+
null termination character). Return the number of :c:type:`wchar_t` characters
864864
copied or ``-1`` in case of an error. Note that the resulting :c:expr:`wchar_t*`
865865
string may or may not be null-terminated. It is the responsibility of the caller
866866
to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
@@ -874,7 +874,7 @@ wchar_t Support
874874
Convert the Unicode object to a wide character string. The output string
875875
always ends with a null character. If *size* is not ``NULL``, write the number
876876
of wide characters (excluding the trailing null termination character) into
877-
*\*size*. Note that the resulting :c:expr:`wchar_t` string might contain
877+
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
878878
null characters, which would cause the string to be truncated when used with
879879
most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string
880880
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
@@ -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‎

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)