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

+1-1
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

+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

+11-11
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

+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
@@ -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

+2-2
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

+6-6
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

+1-1
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

+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/library/webbrowser.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ will be used if graphical browsers are not available or an X11 display isn't
2020
available. If text-mode browsers are used, the calling process will block until
2121
the user exits the browser.
2222

23-
If the environment variable :envvar:`!BROWSER` exists, it is interpreted as the
23+
If the environment variable :envvar:`BROWSER` exists, it is interpreted as the
2424
:data:`os.pathsep`-separated list of browsers to try ahead of the platform
2525
defaults. When the value of a list part contains the string ``%s``, then it is
2626
interpreted as a literal browser command line to be used with the argument URL
@@ -97,7 +97,7 @@ The following functions are defined:
9797

9898
Setting *preferred* to ``True`` makes this browser a preferred result for
9999
a :func:`get` call with no argument. Otherwise, this entry point is only
100-
useful if you plan to either set the :envvar:`!BROWSER` variable or call
100+
useful if you plan to either set the :envvar:`BROWSER` variable or call
101101
:func:`get` with a nonempty argument matching the name of a handler you
102102
declare.
103103

@@ -224,4 +224,4 @@ module-level convenience functions:
224224
.. rubric:: Footnotes
225225

226226
.. [1] Executables named here without a full path will be searched in the
227-
directories given in the :envvar:`!PATH` environment variable.
227+
directories given in the :envvar:`PATH` environment variable.

Doc/tools/.nitignore

-7
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Doc/library/codecs.rst
9191
Doc/library/codeop.rst
9292
Doc/library/collections.abc.rst
9393
Doc/library/collections.rst
94-
Doc/library/compileall.rst
9594
Doc/library/concurrent.futures.rst
9695
Doc/library/concurrent.rst
9796
Doc/library/configparser.rst
@@ -100,7 +99,6 @@ Doc/library/contextlib.rst
10099
Doc/library/copy.rst
101100
Doc/library/csv.rst
102101
Doc/library/ctypes.rst
103-
Doc/library/curses.rst
104102
Doc/library/datetime.rst
105103
Doc/library/dbm.rst
106104
Doc/library/decimal.rst
@@ -137,7 +135,6 @@ Doc/library/http.client.rst
137135
Doc/library/http.cookiejar.rst
138136
Doc/library/http.cookies.rst
139137
Doc/library/http.server.rst
140-
Doc/library/idle.rst
141138
Doc/library/importlib.resources.abc.rst
142139
Doc/library/importlib.resources.rst
143140
Doc/library/importlib.rst
@@ -165,11 +162,9 @@ Doc/library/pickletools.rst
165162
Doc/library/platform.rst
166163
Doc/library/plistlib.rst
167164
Doc/library/poplib.rst
168-
Doc/library/posix.rst
169165
Doc/library/pprint.rst
170166
Doc/library/profile.rst
171167
Doc/library/pty.rst
172-
Doc/library/py_compile.rst
173168
Doc/library/pyclbr.rst
174169
Doc/library/pydoc.rst
175170
Doc/library/pyexpat.rst
@@ -192,7 +187,6 @@ Doc/library/ssl.rst
192187
Doc/library/stat.rst
193188
Doc/library/stdtypes.rst
194189
Doc/library/string.rst
195-
Doc/library/struct.rst
196190
Doc/library/subprocess.rst
197191
Doc/library/sys.rst
198192
Doc/library/sys_path_init.rst
@@ -254,7 +248,6 @@ Doc/tutorial/modules.rst
254248
Doc/tutorial/stdlib2.rst
255249
Doc/using/cmdline.rst
256250
Doc/using/configure.rst
257-
Doc/using/unix.rst
258251
Doc/using/windows.rst
259252
Doc/whatsnew/2.0.rst
260253
Doc/whatsnew/2.1.rst

Doc/whatsnew/3.12.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ Porting to Python 3.12
17681768
for example).
17691769

17701770
* Add support of more formatting options (left aligning, octals, uppercase
1771-
hexadecimals, ``intmax_t``, ``ptrdiff_t``, ``wchar_t`` C
1771+
hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C
17721772
strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` and
17731773
:c:func:`PyUnicode_FromFormatV`.
17741774
(Contributed by Serhiy Storchaka in :gh:`98836`.)

Doc/whatsnew/3.13.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Pending Removal in Python 3.15
329329
Pending Removal in Python 3.16
330330
------------------------------
331331

332-
* :class:`array.array` ``'u'`` type (``wchar_t``):
332+
* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
333333
use the ``'w'`` type instead (``Py_UCS4``).
334334

335335
Pending Removal in Future Versions
@@ -802,8 +802,8 @@ Deprecated
802802
----------
803803

804804
* Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly
805-
the ``wchar_t`` type instead. Since Python 3.3, ``Py_UNICODE`` and
806-
``PY_UNICODE_TYPE`` are just aliases to ``wchar_t``.
805+
the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and
806+
``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`.
807807
(Contributed by Victor Stinner in :gh:`105156`.)
808808

809809
* Deprecate old Python initialization functions:
@@ -1013,8 +1013,8 @@ Pending Removal in Python 3.15
10131013
* :c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`.
10141014
* :c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead.
10151015
* :c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead.
1016-
* :c:type:`!Py_UNICODE_WIDE` type: use ``wchar_t`` instead.
1017-
* :c:type:`Py_UNICODE` type: use ``wchar_t`` instead.
1016+
* :c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead.
1017+
* :c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead.
10181018
* Python initialization functions:
10191019

10201020
* :c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and

Doc/whatsnew/3.3.rst

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

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

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.

0 commit comments

Comments
 (0)