Skip to content

Commit 456cf8b

Browse files
[3.12] gh-106948: Add standard external names to nitpick_ignore (GH-106949) (#107060)
* [3.12] 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". (cherry picked from commit f8b7fe2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> * Delete 2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst
1 parent 98626c3 commit 456cf8b

19 files changed

+89
-44
lines changed

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.

Doc/tools/.nitignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ Doc/library/codecs.rst
100100
Doc/library/codeop.rst
101101
Doc/library/collections.abc.rst
102102
Doc/library/collections.rst
103-
Doc/library/compileall.rst
104103
Doc/library/concurrent.futures.rst
105104
Doc/library/concurrent.rst
106105
Doc/library/configparser.rst
@@ -109,8 +108,6 @@ Doc/library/contextlib.rst
109108
Doc/library/copy.rst
110109
Doc/library/csv.rst
111110
Doc/library/ctypes.rst
112-
Doc/library/curses.ascii.rst
113-
Doc/library/curses.rst
114111
Doc/library/datetime.rst
115112
Doc/library/dbm.rst
116113
Doc/library/decimal.rst
@@ -148,7 +145,6 @@ Doc/library/http.client.rst
148145
Doc/library/http.cookiejar.rst
149146
Doc/library/http.cookies.rst
150147
Doc/library/http.server.rst
151-
Doc/library/idle.rst
152148
Doc/library/importlib.resources.abc.rst
153149
Doc/library/importlib.resources.rst
154150
Doc/library/importlib.rst
@@ -179,11 +175,9 @@ Doc/library/pickletools.rst
179175
Doc/library/platform.rst
180176
Doc/library/plistlib.rst
181177
Doc/library/poplib.rst
182-
Doc/library/posix.rst
183178
Doc/library/pprint.rst
184179
Doc/library/profile.rst
185180
Doc/library/pty.rst
186-
Doc/library/py_compile.rst
187181
Doc/library/pyclbr.rst
188182
Doc/library/pydoc.rst
189183
Doc/library/pyexpat.rst
@@ -206,7 +200,6 @@ Doc/library/ssl.rst
206200
Doc/library/stat.rst
207201
Doc/library/stdtypes.rst
208202
Doc/library/string.rst
209-
Doc/library/struct.rst
210203
Doc/library/subprocess.rst
211204
Doc/library/sunau.rst
212205
Doc/library/sys.rst
@@ -273,7 +266,6 @@ Doc/tutorial/modules.rst
273266
Doc/tutorial/stdlib2.rst
274267
Doc/using/cmdline.rst
275268
Doc/using/configure.rst
276-
Doc/using/unix.rst
277269
Doc/using/windows.rst
278270
Doc/whatsnew/2.0.rst
279271
Doc/whatsnew/2.1.rst

Doc/whatsnew/3.12.rst

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

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

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

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

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

Misc/NEWS.d/3.12.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5308,7 +5308,7 @@ parameter. Patch by Kumar Aditya.
53085308
.. section: Build
53095309
53105310
Python now always use the ``%zu`` and ``%zd`` printf formats to format a
5311-
``size_t`` or ``Py_ssize_t`` number. Building Python 3.12 requires a C11
5311+
:c:type:`size_t` or ``Py_ssize_t`` number. Building Python 3.12 requires a C11
53125312
compiler, so these printf formats are now always supported. Patch by Victor
53135313
Stinner.
53145314

Misc/NEWS.d/3.12.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@ Patch by Dong-hee Na.
23822382
.. section: C API
23832383
23842384
Add support of more formatting options (left aligning, octals, uppercase
2385-
hexadecimals, :c:expr:`intmax_t`, :c:expr:`ptrdiff_t`, :c:expr:`wchar_t` C
2385+
hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C
23862386
strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` and
23872387
:c:func:`PyUnicode_FromFormatV`.
23882388

Lines changed: 1 addition & 0 deletions
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)