Skip to content

Commit 1af2a98

Browse files
committed
Merge branch 'main' into typewatch
* main: (53 commits) pythongh-94808: Coverage: Test that maximum indentation level is handled (python#95926) pythonGH-88050: fix race in closing subprocess pipe in asyncio (python#97951) pythongh-93738: Disallow pre-v3 syntax in the C domain (python#97962) pythongh-95986: Fix the example using match keyword (python#95989) pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (pythonGH-97944) pythongh-94808: Cover `PyUnicode_Count` in CAPI (python#96929) pythongh-94808: Cover `PyObject_PyBytes` case with custom `__bytes__` method (python#96610) pythongh-95691: Doc BufferedWriter and BufferedReader (python#95703) pythonGH-88968: Add notes about socket ownership transfers (python#97936) pythongh-96865: [Enum] fix Flag to use CONFORM boundary (pythonGH-97528) pythongh-65961: Raise `DeprecationWarning` when `__package__` differs from `__spec__.parent` (python#97879) docs(typing): add "see PEP 675" to LiteralString (python#97926) pythongh-97850: Remove all known instances of module_repr() (python#97876) I changed my surname early this year (python#96671) pythongh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (python#97768) pythongh-91539: improve performance of get_proxies_environment (python#91566) build(deps): bump actions/stale from 5 to 6 (python#97701) pythonGH-95172 Make the same version `versionadded` oneline (python#95172) pythongh-88050: Fix asyncio subprocess to kill process cleanly when process is blocked (python#32073) pythongh-93738: Documentation C syntax (Function glob patterns -> literal markup) (python#97774) ...
2 parents 95e49ee + 23e83a8 commit 1af2a98

File tree

159 files changed

+52338
-1396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+52338
-1396
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Include/internal/pycore_runtime_init_generated.h generated
7373
Include/opcode.h generated
7474
Include/token.h generated
7575
Lib/keyword.py generated
76+
Lib/test/levenshtein_examples.json generated
7677
Lib/test/test_stable_abi_ctypes.py generated
7778
Lib/token.py generated
7879
Objects/typeslots.inc generated

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: "Check PRs"
18-
uses: actions/stale@v5
18+
uses: actions/stale@v6
1919
with:
2020
repo-token: ${{ secrets.GITHUB_TOKEN }}
2121
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'

Doc/c-api/arg.rst

+44-44
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ which disallows mutable objects such as :class:`bytearray`.
129129
``S`` (:class:`bytes`) [PyBytesObject \*]
130130
Requires that the Python object is a :class:`bytes` object, without
131131
attempting any conversion. Raises :exc:`TypeError` if the object is not
132-
a bytes object. The C variable may also be declared as :c:type:`PyObject*`.
132+
a bytes object. The C variable may also be declared as :c:expr:`PyObject*`.
133133

134134
``Y`` (:class:`bytearray`) [PyByteArrayObject \*]
135135
Requires that the Python object is a :class:`bytearray` object, without
136136
attempting any conversion. Raises :exc:`TypeError` if the object is not
137-
a :class:`bytearray` object. The C variable may also be declared as :c:type:`PyObject*`.
137+
a :class:`bytearray` object. The C variable may also be declared as :c:expr:`PyObject*`.
138138

139139
``U`` (:class:`str`) [PyObject \*]
140140
Requires that the Python object is a Unicode object, without attempting
141141
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
142-
object. The C variable may also be declared as :c:type:`PyObject*`.
142+
object. The C variable may also be declared as :c:expr:`PyObject*`.
143143

144144
``w*`` (read-write :term:`bytes-like object`) [Py_buffer]
145145
This format accepts any object which implements the read-write buffer
@@ -152,10 +152,10 @@ which disallows mutable objects such as :class:`bytearray`.
152152
It only works for encoded data without embedded NUL bytes.
153153

154154
This format requires two arguments. The first is only used as input, and
155-
must be a :c:type:`const char*` which points to the name of an encoding as a
155+
must be a :c:expr:`const char*` which points to the name of an encoding as a
156156
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
157157
An exception is raised if the named encoding is not known to Python. The
158-
second argument must be a :c:type:`char**`; the value of the pointer it
158+
second argument must be a :c:expr:`char**`; the value of the pointer it
159159
references will be set to a buffer with the contents of the argument text.
160160
The text will be encoded in the encoding specified by the first argument.
161161

@@ -175,10 +175,10 @@ which disallows mutable objects such as :class:`bytearray`.
175175
characters.
176176

177177
It requires three arguments. The first is only used as input, and must be a
178-
:c:type:`const char*` which points to the name of an encoding as a
178+
:c:expr:`const char*` which points to the name of an encoding as a
179179
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
180180
An exception is raised if the named encoding is not known to Python. The
181-
second argument must be a :c:type:`char**`; the value of the pointer it
181+
second argument must be a :c:expr:`char**`; the value of the pointer it
182182
references will be set to a buffer with the contents of the argument text.
183183
The text will be encoded in the encoding specified by the first argument.
184184
The third argument must be a pointer to an integer; the referenced integer
@@ -215,59 +215,59 @@ Numbers
215215

216216
``b`` (:class:`int`) [unsigned char]
217217
Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
218-
:c:type:`unsigned char`.
218+
:c:expr:`unsigned char`.
219219

220220
``B`` (:class:`int`) [unsigned char]
221221
Convert a Python integer to a tiny int without overflow checking, stored in a C
222-
:c:type:`unsigned char`.
222+
:c:expr:`unsigned char`.
223223

224224
``h`` (:class:`int`) [short int]
225-
Convert a Python integer to a C :c:type:`short int`.
225+
Convert a Python integer to a C :c:expr:`short int`.
226226

227227
``H`` (:class:`int`) [unsigned short int]
228-
Convert a Python integer to a C :c:type:`unsigned short int`, without overflow
228+
Convert a Python integer to a C :c:expr:`unsigned short int`, without overflow
229229
checking.
230230

231231
``i`` (:class:`int`) [int]
232-
Convert a Python integer to a plain C :c:type:`int`.
232+
Convert a Python integer to a plain C :c:expr:`int`.
233233

234234
``I`` (:class:`int`) [unsigned int]
235-
Convert a Python integer to a C :c:type:`unsigned int`, without overflow
235+
Convert a Python integer to a C :c:expr:`unsigned int`, without overflow
236236
checking.
237237

238238
``l`` (:class:`int`) [long int]
239-
Convert a Python integer to a C :c:type:`long int`.
239+
Convert a Python integer to a C :c:expr:`long int`.
240240

241241
``k`` (:class:`int`) [unsigned long]
242-
Convert a Python integer to a C :c:type:`unsigned long` without
242+
Convert a Python integer to a C :c:expr:`unsigned long` without
243243
overflow checking.
244244

245245
``L`` (:class:`int`) [long long]
246-
Convert a Python integer to a C :c:type:`long long`.
246+
Convert a Python integer to a C :c:expr:`long long`.
247247

248248
``K`` (:class:`int`) [unsigned long long]
249-
Convert a Python integer to a C :c:type:`unsigned long long`
249+
Convert a Python integer to a C :c:expr:`unsigned long long`
250250
without overflow checking.
251251

252252
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
253253
Convert a Python integer to a C :c:type:`Py_ssize_t`.
254254

255255
``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]
256256
Convert a Python byte, represented as a :class:`bytes` or
257-
:class:`bytearray` object of length 1, to a C :c:type:`char`.
257+
:class:`bytearray` object of length 1, to a C :c:expr:`char`.
258258

259259
.. versionchanged:: 3.3
260260
Allow :class:`bytearray` objects.
261261

262262
``C`` (:class:`str` of length 1) [int]
263263
Convert a Python character, represented as a :class:`str` object of
264-
length 1, to a C :c:type:`int`.
264+
length 1, to a C :c:expr:`int`.
265265

266266
``f`` (:class:`float`) [float]
267-
Convert a Python floating point number to a C :c:type:`float`.
267+
Convert a Python floating point number to a C :c:expr:`float`.
268268

269269
``d`` (:class:`float`) [double]
270-
Convert a Python floating point number to a C :c:type:`double`.
270+
Convert a Python floating point number to a C :c:expr:`double`.
271271

272272
``D`` (:class:`complex`) [Py_complex]
273273
Convert a Python complex number to a C :c:type:`Py_complex` structure.
@@ -283,7 +283,7 @@ Other objects
283283
``O!`` (object) [*typeobject*, PyObject \*]
284284
Store a Python object in a C object pointer. This is similar to ``O``, but
285285
takes two C arguments: the first is the address of a Python type object, the
286-
second is the address of the C variable (of type :c:type:`PyObject*`) into which
286+
second is the address of the C variable (of type :c:expr:`PyObject*`) into which
287287
the object pointer is stored. If the Python object does not have the required
288288
type, :exc:`TypeError` is raised.
289289

@@ -292,13 +292,13 @@ Other objects
292292
``O&`` (object) [*converter*, *anything*]
293293
Convert a Python object to a C variable through a *converter* function. This
294294
takes two arguments: the first is a function, the second is the address of a C
295-
variable (of arbitrary type), converted to :c:type:`void *`. The *converter*
295+
variable (of arbitrary type), converted to :c:expr:`void *`. The *converter*
296296
function in turn is called as follows::
297297

298298
status = converter(object, address);
299299

300300
where *object* is the Python object to be converted and *address* is the
301-
:c:type:`void*` argument that was passed to the :c:func:`PyArg_Parse\*` function.
301+
:c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` function.
302302
The returned *status* should be ``1`` for a successful conversion and ``0`` if
303303
the conversion has failed. When the conversion fails, the *converter* function
304304
should raise an exception and leave the content of *address* unmodified.
@@ -372,9 +372,9 @@ what is specified for the corresponding format unit in that case.
372372

373373
For the conversion to succeed, the *arg* object must match the format
374374
and the format must be exhausted. On success, the
375-
:c:func:`PyArg_Parse\*` functions return true, otherwise they return
375+
``PyArg_Parse*`` functions return true, otherwise they return
376376
false and raise an appropriate exception. When the
377-
:c:func:`PyArg_Parse\*` functions fail due to conversion failure in one
377+
``PyArg_Parse*`` functions fail due to conversion failure in one
378378
of the format units, the variables at the addresses corresponding to that
379379
and the following format units are left untouched.
380380

@@ -444,7 +444,7 @@ API Functions
444444
*args*; it must actually be a tuple. The length of the tuple must be at least
445445
*min* and no more than *max*; *min* and *max* may be equal. Additional
446446
arguments must be passed to the function, each of which should be a pointer to a
447-
:c:type:`PyObject*` variable; these will be filled in with the values from
447+
:c:expr:`PyObject*` variable; these will be filled in with the values from
448448
*args*; they will contain :term:`borrowed references <borrowed reference>`.
449449
The variables which correspond
450450
to optional parameters not given by *args* will not be filled in; these should
@@ -481,7 +481,7 @@ Building values
481481
.. c:function:: PyObject* Py_BuildValue(const char *format, ...)
482482
483483
Create a new value based on a format string similar to those accepted by the
484-
:c:func:`PyArg_Parse\*` family of functions and a sequence of values. Returns
484+
``PyArg_Parse*`` family of functions and a sequence of values. Returns
485485
the value or ``NULL`` in the case of an error; an exception will be raised if
486486
``NULL`` is returned.
487487
@@ -531,7 +531,7 @@ Building values
531531
Same as ``s#``.
532532
533533
``u`` (:class:`str`) [const wchar_t \*]
534-
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
534+
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
535535
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
536536
``None`` is returned.
537537
@@ -547,51 +547,51 @@ Building values
547547
Same as ``s#``.
548548
549549
``i`` (:class:`int`) [int]
550-
Convert a plain C :c:type:`int` to a Python integer object.
550+
Convert a plain C :c:expr:`int` to a Python integer object.
551551
552552
``b`` (:class:`int`) [char]
553-
Convert a plain C :c:type:`char` to a Python integer object.
553+
Convert a plain C :c:expr:`char` to a Python integer object.
554554
555555
``h`` (:class:`int`) [short int]
556-
Convert a plain C :c:type:`short int` to a Python integer object.
556+
Convert a plain C :c:expr:`short int` to a Python integer object.
557557
558558
``l`` (:class:`int`) [long int]
559-
Convert a C :c:type:`long int` to a Python integer object.
559+
Convert a C :c:expr:`long int` to a Python integer object.
560560
561561
``B`` (:class:`int`) [unsigned char]
562-
Convert a C :c:type:`unsigned char` to a Python integer object.
562+
Convert a C :c:expr:`unsigned char` to a Python integer object.
563563
564564
``H`` (:class:`int`) [unsigned short int]
565-
Convert a C :c:type:`unsigned short int` to a Python integer object.
565+
Convert a C :c:expr:`unsigned short int` to a Python integer object.
566566
567567
``I`` (:class:`int`) [unsigned int]
568-
Convert a C :c:type:`unsigned int` to a Python integer object.
568+
Convert a C :c:expr:`unsigned int` to a Python integer object.
569569
570570
``k`` (:class:`int`) [unsigned long]
571-
Convert a C :c:type:`unsigned long` to a Python integer object.
571+
Convert a C :c:expr:`unsigned long` to a Python integer object.
572572
573573
``L`` (:class:`int`) [long long]
574-
Convert a C :c:type:`long long` to a Python integer object.
574+
Convert a C :c:expr:`long long` to a Python integer object.
575575
576576
``K`` (:class:`int`) [unsigned long long]
577-
Convert a C :c:type:`unsigned long long` to a Python integer object.
577+
Convert a C :c:expr:`unsigned long long` to a Python integer object.
578578
579579
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
580580
Convert a C :c:type:`Py_ssize_t` to a Python integer.
581581
582582
``c`` (:class:`bytes` of length 1) [char]
583-
Convert a C :c:type:`int` representing a byte to a Python :class:`bytes` object of
583+
Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` object of
584584
length 1.
585585
586586
``C`` (:class:`str` of length 1) [int]
587-
Convert a C :c:type:`int` representing a character to Python :class:`str`
587+
Convert a C :c:expr:`int` representing a character to Python :class:`str`
588588
object of length 1.
589589
590590
``d`` (:class:`float`) [double]
591-
Convert a C :c:type:`double` to a Python floating point number.
591+
Convert a C :c:expr:`double` to a Python floating point number.
592592
593593
``f`` (:class:`float`) [float]
594-
Convert a C :c:type:`float` to a Python floating point number.
594+
Convert a C :c:expr:`float` to a Python floating point number.
595595
596596
``D`` (:class:`complex`) [Py_complex \*]
597597
Convert a C :c:type:`Py_complex` structure to a Python complex number.
@@ -614,7 +614,7 @@ Building values
614614
615615
``O&`` (object) [*converter*, *anything*]
616616
Convert *anything* to a Python object through a *converter* function. The
617-
function is called with *anything* (which should be compatible with :c:type:`void*`)
617+
function is called with *anything* (which should be compatible with :c:expr:`void*`)
618618
as its argument and should return a "new" Python object, or ``NULL`` if an
619619
error occurred.
620620

Doc/c-api/call.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ please see individual documentation for details.
284284
285285
This is the equivalent of the Python expression: ``callable(*args)``.
286286
287-
Note that if you only pass :c:type:`PyObject *` args,
287+
Note that if you only pass :c:expr:`PyObject *` args,
288288
:c:func:`PyObject_CallFunctionObjArgs` is a faster alternative.
289289
290290
.. versionchanged:: 3.4
@@ -305,7 +305,7 @@ please see individual documentation for details.
305305
This is the equivalent of the Python expression:
306306
``obj.name(arg1, arg2, ...)``.
307307
308-
Note that if you only pass :c:type:`PyObject *` args,
308+
Note that if you only pass :c:expr:`PyObject *` args,
309309
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
310310
311311
.. versionchanged:: 3.4
@@ -315,7 +315,7 @@ please see individual documentation for details.
315315
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ...)
316316
317317
Call a callable Python object *callable*, with a variable number of
318-
:c:type:`PyObject *` arguments. The arguments are provided as a variable number
318+
:c:expr:`PyObject *` arguments. The arguments are provided as a variable number
319319
of parameters followed by *NULL*.
320320
321321
Return the result of the call on success, or raise an exception and return
@@ -329,7 +329,7 @@ please see individual documentation for details.
329329
330330
Call a method of the Python object *obj*, where the name of the method is given as a
331331
Python string object in *name*. It is called with a variable number of
332-
:c:type:`PyObject *` arguments. The arguments are provided as a variable number
332+
:c:expr:`PyObject *` arguments. The arguments are provided as a variable number
333333
of parameters followed by *NULL*.
334334
335335
Return the result of the call on success, or raise an exception and return

Doc/c-api/capsule.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
1515
.. c:type:: PyCapsule
1616
1717
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
18-
extension modules who need to pass an opaque value (as a :c:type:`void*`
18+
extension modules who need to pass an opaque value (as a :c:expr:`void*`
1919
pointer) through Python code to other C code. It is often used to make a C
2020
function pointer defined in one module available to other modules, so the
2121
regular import mechanism can be used to access C APIs defined in dynamically

Doc/c-api/complex.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ Complex Numbers as Python Objects
115115
116116
.. c:function:: double PyComplex_RealAsDouble(PyObject *op)
117117
118-
Return the real part of *op* as a C :c:type:`double`.
118+
Return the real part of *op* as a C :c:expr:`double`.
119119
120120
121121
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
122122
123-
Return the imaginary part of *op* as a C :c:type:`double`.
123+
Return the imaginary part of *op* as a C :c:expr:`double`.
124124
125125
126126
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)

Doc/c-api/conversion.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The following functions provide locale-independent string to number conversions.
4949
5050
.. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
5151
52-
Convert a string ``s`` to a :c:type:`double`, raising a Python
52+
Convert a string ``s`` to a :c:expr:`double`, raising a Python
5353
exception on failure. The set of accepted strings corresponds to
5454
the set of strings accepted by Python's :func:`float` constructor,
5555
except that ``s`` must not have leading or trailing whitespace.
@@ -83,7 +83,7 @@ The following functions provide locale-independent string to number conversions.
8383
8484
.. c:function:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype)
8585
86-
Convert a :c:type:`double` *val* to a string using supplied
86+
Convert a :c:expr:`double` *val* to a string using supplied
8787
*format_code*, *precision*, and *flags*.
8888
8989
*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``,

Doc/c-api/dict.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Dictionary Objects
7373
.. index:: single: PyUnicode_FromString()
7474
7575
Insert *val* into the dictionary *p* using *key* as a key. *key* should
76-
be a :c:type:`const char*`. The key object is created using
76+
be a :c:expr:`const char*`. The key object is created using
7777
``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on
7878
failure. This function *does not* steal a reference to *val*.
7979
@@ -118,7 +118,7 @@ Dictionary Objects
118118
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
119119
120120
This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a
121-
:c:type:`const char*`, rather than a :c:type:`PyObject*`.
121+
:c:expr:`const char*`, rather than a :c:expr:`PyObject*`.
122122
123123
Note that exceptions which occur while calling :meth:`__hash__` and
124124
:meth:`__eq__` methods and creating a temporary string object
@@ -167,7 +167,7 @@ Dictionary Objects
167167
prior to the first call to this function to start the iteration; the
168168
function returns true for each pair in the dictionary, and false once all
169169
pairs have been reported. The parameters *pkey* and *pvalue* should either
170-
point to :c:type:`PyObject*` variables that will be filled in with each key
170+
point to :c:expr:`PyObject*` variables that will be filled in with each key
171171
and value, respectively, or may be ``NULL``. Any references returned through
172172
them are borrowed. *ppos* should not be altered during iteration. Its
173173
value represents offsets within the internal dictionary structure, and

0 commit comments

Comments
 (0)