Skip to content

Commit 38573d3

Browse files
authored
Merge branch 'main' into Optimize-_MATCH_CLASS
2 parents a70b403 + 9796856 commit 38573d3

File tree

374 files changed

+7950
-4497
lines changed

Some content is hidden

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

374 files changed

+7950
-4497
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ Tools/c-analyzer/ @ericsnowcurrently
132132
Tools/check-c-api-docs/ @ZeroIntensity
133133

134134
# Fuzzing
135-
Modules/_xxtestfuzz/ @ammaraskar
135+
Modules/_xxtestfuzz/ @python/fuzzers
136+
Lib/test/test_xxtestfuzz.py @python/fuzzers
137+
.github/workflows/reusable-cifuzz.yml @python/fuzzers
136138

137139
# Limited C API & Stable ABI
138140
Doc/c-api/stable.rst @encukou

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
// We need to truncate the body size, because the max size for
4545
// the whole payload is 16kb. We want to be safe and assume that
4646
// body can take up to ~8kb of space.
47-
body : issue.data.body.substring(0, 8000)
47+
body : (issue.data.body || "").substring(0, 8000)
4848
};
4949
5050
const data = {

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Tools/unicode/data/
137137
/config.status
138138
/config.status.lineno
139139
/.ccache
140-
/cross-build/
140+
/cross-build*/
141141
/jit_stencils*.h
142142
/platform
143143
/profile-clean-stamp

Doc/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ htmlhelp: build
8888
"build/htmlhelp/pydoc.hhp project file."
8989

9090
.PHONY: latex
91+
latex: _ensure-sphinxcontrib-svg2pdfconverter
9192
latex: BUILDER = latex
9293
latex: build
9394
@echo "Build finished; the LaTeX files are in build/latex."
@@ -231,7 +232,7 @@ dist-text:
231232
@echo "Build finished and archived!"
232233

233234
.PHONY: dist-pdf
234-
dist-pdf:
235+
dist-pdf: _ensure-sphinxcontrib-svg2pdfconverter
235236
# archive the A4 latex
236237
@echo "Building LaTeX (A4 paper)..."
237238
mkdir -p dist
@@ -292,6 +293,10 @@ _ensure-pre-commit:
292293
_ensure-sphinx-autobuild:
293294
$(MAKE) _ensure-package PACKAGE=sphinx-autobuild
294295

296+
.PHONY: _ensure-sphinxcontrib-svg2pdfconverter
297+
_ensure-sphinxcontrib-svg2pdfconverter:
298+
$(MAKE) _ensure-package PACKAGE=sphinxcontrib-svg2pdfconverter
299+
295300
.PHONY: check
296301
check: _ensure-pre-commit
297302
$(VENVDIR)/bin/python3 -m pre_commit run --all-files

Doc/c-api/arg.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,28 @@ API Functions
516516
}
517517
518518
519+
.. c:function:: int PyArg_ParseArray(PyObject *const *args, Py_ssize_t nargs, const char *format, ...)
520+
521+
Parse the parameters of a function that takes only array parameters into
522+
local variables (that is, a function using the :c:macro:`METH_FASTCALL`
523+
calling convention).
524+
Returns true on success; on failure, it returns false and raises the
525+
appropriate exception.
526+
527+
.. versionadded:: 3.15
528+
529+
530+
.. c:function:: int PyArg_ParseArrayAndKeywords(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, const char *format, const char * const *kwlist, ...)
531+
532+
Parse the parameters of a function that takes both array and keyword
533+
parameters into local variables (that is, a function using the
534+
:c:macro:`METH_FASTCALL` ``|`` :c:macro:`METH_KEYWORDS` calling convention).
535+
Returns true on success; on failure, it returns false and raises the
536+
appropriate exception.
537+
538+
.. versionadded:: 3.15
539+
540+
519541
.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)
520542
521543
A simpler form of parameter retrieval which does not use a format string to

Doc/c-api/bytes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,17 @@ Getters
371371
372372
Get the writer size.
373373
374+
The function cannot fail.
375+
374376
.. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
375377
376378
Get the writer data: start of the internal buffer.
377379
378380
The pointer is valid until :c:func:`PyBytesWriter_Finish` or
379381
:c:func:`PyBytesWriter_Discard` is called on *writer*.
380382
383+
The function cannot fail.
384+
381385
382386
Low-level API
383387
^^^^^^^^^^^^^

Doc/c-api/dict.rst

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ Dictionary objects
4242
enforces read-only behavior. This is normally used to create a view to
4343
prevent modification of the dictionary for non-dynamic class types.
4444
45+
The first argument can be a :class:`dict`, a :class:`frozendict`, or a
46+
mapping.
47+
48+
.. versionchanged:: next
49+
Also accept :class:`frozendict`.
50+
4551
4652
.. c:var:: PyTypeObject PyDictProxy_Type
4753
@@ -68,15 +74,25 @@ Dictionary objects
6874
*key*, return ``1``, otherwise return ``0``. On error, return ``-1``.
6975
This is equivalent to the Python expression ``key in p``.
7076
77+
The first argument can be a :class:`dict` or a :class:`frozendict`.
78+
79+
.. versionchanged:: next
80+
Also accept :class:`frozendict`.
81+
7182
7283
.. c:function:: int PyDict_ContainsString(PyObject *p, const char *key)
7384
7485
This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a
7586
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
7687
:c:expr:`PyObject*`.
7788
89+
The first argument can be a :class:`dict` or a :class:`frozendict`.
90+
7891
.. versionadded:: 3.13
7992
93+
.. versionchanged:: next
94+
Also accept :class:`frozendict`.
95+
8096
8197
.. c:function:: PyObject* PyDict_Copy(PyObject *p)
8298
@@ -122,8 +138,13 @@ Dictionary objects
122138
* If the key is missing, set *\*result* to ``NULL`` and return ``0``.
123139
* On error, raise an exception and return ``-1``.
124140
141+
The first argument can be a :class:`dict` or a :class:`frozendict`.
142+
125143
.. versionadded:: 3.13
126144
145+
.. versionchanged:: next
146+
Also accept :class:`frozendict`.
147+
127148
See also the :c:func:`PyObject_GetItem` function.
128149
129150
@@ -133,6 +154,8 @@ Dictionary objects
133154
has a key *key*. Return ``NULL`` if the key *key* is missing *without*
134155
setting an exception.
135156
157+
The first argument can be a :class:`dict` or a :class:`frozendict`.
158+
136159
.. note::
137160
138161
Exceptions that occur while this calls :meth:`~object.__hash__` and
@@ -143,6 +166,9 @@ Dictionary objects
143166
Calling this API without an :term:`attached thread state` had been allowed for historical
144167
reason. It is no longer allowed.
145168
169+
.. versionchanged:: next
170+
Also accept :class:`frozendict`.
171+
146172
147173
.. c:function:: PyObject* PyDict_GetItemWithError(PyObject *p, PyObject *key)
148174
@@ -151,6 +177,9 @@ Dictionary objects
151177
occurred. Return ``NULL`` **without** an exception set if the key
152178
wasn't present.
153179
180+
.. versionchanged:: next
181+
Also accept :class:`frozendict`.
182+
154183
155184
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
156185
@@ -166,6 +195,9 @@ Dictionary objects
166195
Prefer using the :c:func:`PyDict_GetItemWithError` function with your own
167196
:c:func:`PyUnicode_FromString` *key* instead.
168197
198+
.. versionchanged:: next
199+
Also accept :class:`frozendict`.
200+
169201
170202
.. c:function:: int PyDict_GetItemStringRef(PyObject *p, const char *key, PyObject **result)
171203
@@ -175,6 +207,9 @@ Dictionary objects
175207
176208
.. versionadded:: 3.13
177209
210+
.. versionchanged:: next
211+
Also accept :class:`frozendict`.
212+
178213
179214
.. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *defaultobj)
180215
@@ -238,17 +273,32 @@ Dictionary objects
238273
239274
Return a :c:type:`PyListObject` containing all the items from the dictionary.
240275
276+
The first argument can be a :class:`dict` or a :class:`frozendict`.
277+
278+
.. versionchanged:: next
279+
Also accept :class:`frozendict`.
280+
241281
242282
.. c:function:: PyObject* PyDict_Keys(PyObject *p)
243283
244284
Return a :c:type:`PyListObject` containing all the keys from the dictionary.
245285
286+
The first argument can be a :class:`dict` or a :class:`frozendict`.
287+
288+
.. versionchanged:: next
289+
Also accept :class:`frozendict`.
290+
246291
247292
.. c:function:: PyObject* PyDict_Values(PyObject *p)
248293
249294
Return a :c:type:`PyListObject` containing all the values from the dictionary
250295
*p*.
251296
297+
The first argument can be a :class:`dict` or a :class:`frozendict`.
298+
299+
.. versionchanged:: next
300+
Also accept :class:`frozendict`.
301+
252302
253303
.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)
254304
@@ -257,11 +307,19 @@ Dictionary objects
257307
Return the number of items in the dictionary. This is equivalent to
258308
``len(p)`` on a dictionary.
259309
310+
The argument can be a :class:`dict` or a :class:`frozendict`.
311+
312+
.. versionchanged:: next
313+
Also accept :class:`frozendict`.
314+
260315
261316
.. c:function:: Py_ssize_t PyDict_GET_SIZE(PyObject *p)
262317
263318
Similar to :c:func:`PyDict_Size`, but without error checking.
264319
320+
.. versionchanged:: next
321+
Also accept :class:`frozendict`.
322+
265323
266324
.. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
267325
@@ -276,6 +334,8 @@ Dictionary objects
276334
value represents offsets within the internal dictionary structure, and
277335
since the structure is sparse, the offsets are not consecutive.
278336
337+
The first argument can be a :class:`dict` or a :class:`frozendict`.
338+
279339
For example::
280340
281341
PyObject *key, *value;
@@ -309,7 +369,7 @@ Dictionary objects
309369
}
310370
311371
The function is not thread-safe in the :term:`free-threaded <free threading>`
312-
build without external synchronization. You can use
372+
build without external synchronization for a mutable :class:`dict`. You can use
313373
:c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating
314374
over it::
315375
@@ -319,6 +379,8 @@ Dictionary objects
319379
}
320380
Py_END_CRITICAL_SECTION();
321381
382+
The function is thread-safe on a :class:`frozendict`.
383+
322384
.. note::
323385
324386
On the free-threaded build, this function can be used safely inside a
@@ -329,6 +391,9 @@ Dictionary objects
329391
:term:`strong reference <strong reference>` (for example, using
330392
:c:func:`Py_NewRef`).
331393
394+
.. versionchanged:: next
395+
Also accept :class:`frozendict`.
396+
332397
.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
333398
334399
Iterate over mapping object *b* adding key-value pairs to dictionary *a*.
@@ -495,7 +560,7 @@ Dictionary view objects
495560
Frozen dictionary objects
496561
^^^^^^^^^^^^^^^^^^^^^^^^^
497562
498-
.. versionadded:: next
563+
.. versionadded:: 3.15
499564
500565
501566
.. c:var:: PyTypeObject PyFrozenDict_Type

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ Signal Handling
716716
This function may now execute a remote debugger script, if remote
717717
debugging is enabled.
718718
719-
.. versionchanged:: next
719+
.. versionchanged:: 3.15
720720
The exception set by :c:func:`PyThreadState_SetAsyncExc` is now raised.
721721
722722

Doc/c-api/float.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,6 @@ endian processor, or ``0`` on little endian processor.
224224
Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
225225
most likely :exc:`OverflowError`).
226226
227-
There are two problems on non-IEEE platforms:
228-
229-
* What this does is undefined if *x* is a NaN or infinity.
230-
* ``-0.0`` and ``+0.0`` produce the same bytes string.
231-
232227
.. c:function:: int PyFloat_Pack2(double x, char *p, int le)
233228
234229
Pack a C double as the IEEE 754 binary16 half-precision format.
@@ -256,9 +251,6 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
256251
:c:func:`PyErr_Occurred` is true (and an exception is set, most likely
257252
:exc:`OverflowError`).
258253
259-
Note that on a non-IEEE platform this will refuse to unpack a bytes string that
260-
represents a NaN or infinity.
261-
262254
.. c:function:: double PyFloat_Unpack2(const char *p, int le)
263255
264256
Unpack the IEEE 754 binary16 half-precision format as a C double.

Doc/c-api/import.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,14 @@ Importing Modules
350350
351351
Gets the current lazy imports mode.
352352
353-
.. versionadded:: next
353+
.. versionadded:: 3.15
354354
355355
.. c:function:: PyObject* PyImport_GetLazyImportsFilter()
356356
357357
Return a :term:`strong reference` to the current lazy imports filter,
358358
or ``NULL`` if none exists. This function always succeeds.
359359
360-
.. versionadded:: next
360+
.. versionadded:: 3.15
361361
362362
.. c:function:: int PyImport_SetLazyImportsMode(PyImport_LazyImportsMode mode)
363363
@@ -366,7 +366,7 @@ Importing Modules
366366
367367
This function always returns ``0``.
368368
369-
.. versionadded:: next
369+
.. versionadded:: 3.15
370370
371371
.. c:function:: int PyImport_SetLazyImportsFilter(PyObject *filter)
372372
@@ -377,7 +377,7 @@ Importing Modules
377377
378378
Return ``0`` on success and ``-1`` with an exception set otherwise.
379379
380-
.. versionadded:: next
380+
.. versionadded:: 3.15
381381
382382
.. c:type:: PyImport_LazyImportsMode
383383
@@ -396,7 +396,7 @@ Importing Modules
396396
Disable lazy imports entirely. Even explicit ``lazy`` statements become
397397
eager imports.
398398
399-
.. versionadded:: next
399+
.. versionadded:: 3.15
400400
401401
.. c:function:: PyObject* PyImport_CreateModuleFromInitfunc(PyObject *spec, PyObject* (*initfunc)(void))
402402

0 commit comments

Comments
 (0)