Skip to content

Commit 8157604

Browse files
authored
Merge branch 'main' into ctypes-emscripten
2 parents 918f979 + 9a8bc6d commit 8157604

File tree

104 files changed

+1759
-708
lines changed

Some content is hidden

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

104 files changed

+1759
-708
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Tools/patchcheck/ @AA-Turner
8282
# Autotools
8383
configure* @erlend-aasland @corona10 @AA-Turner @emmatyping
8484
Makefile.pre.in @erlend-aasland @AA-Turner @emmatyping
85+
Modules/makesetup @erlend-aasland @AA-Turner @emmatyping
8586
Modules/Setup* @erlend-aasland @AA-Turner @emmatyping
86-
Modules/makesetup @emmatyping
8787
Tools/build/regen-configure.sh @AA-Turner
8888

8989

Doc/c-api/bytes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ called with a non-bytes parameter.
4747
*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents of
4848
the bytes object are uninitialized.
4949
50+
.. deprecated:: 3.15
51+
``PyBytes_FromStringAndSize(NULL, len)`` is :term:`soft deprecated`,
52+
use the :c:type:`PyBytesWriter` API instead.
53+
5054
5155
.. c:function:: PyObject* PyBytes_FromFormat(const char *format, ...)
5256
@@ -220,6 +224,12 @@ called with a non-bytes parameter.
220224
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
221225
returned.
222226
227+
.. deprecated:: 3.15
228+
The function is :term:`soft deprecated`,
229+
use the :c:type:`PyBytesWriter` API instead.
230+
231+
.. _pybyteswriter:
232+
223233
PyBytesWriter
224234
-------------
225235

Doc/c-api/init.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ The following functions can be safely called before Python is initialized:
4141
* :c:func:`PyObject_SetArenaAllocator`
4242
* :c:func:`Py_SetProgramName`
4343
* :c:func:`Py_SetPythonHome`
44-
* :c:func:`PySys_ResetWarnOptions`
4544
* the configuration functions covered in :ref:`init-config`
4645

4746
* Informative functions:
@@ -2011,6 +2010,11 @@ Reference tracing
20112010
is set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer
20122011
that was provided when :c:func:`PyRefTracer_SetTracer` was called.
20132012
2013+
If a new tracing function is registered replacing the current a call to the
2014+
trace function will be made with the object set to **NULL** and **event** set to
2015+
:c:data:`PyRefTracer_TRACKER_REMOVED`. This will happen just before the new
2016+
function is registered.
2017+
20142018
.. versionadded:: 3.13
20152019
20162020
.. c:var:: int PyRefTracer_CREATE
@@ -2023,6 +2027,13 @@ Reference tracing
20232027
The value for the *event* parameter to :c:type:`PyRefTracer` functions when a Python
20242028
object has been destroyed.
20252029
2030+
.. c:var:: int PyRefTracer_TRACKER_REMOVED
2031+
2032+
The value for the *event* parameter to :c:type:`PyRefTracer` functions when the
2033+
current tracer is about to be replaced by a new one.
2034+
2035+
.. versionadded:: 3.14
2036+
20262037
.. c:function:: int PyRefTracer_SetTracer(PyRefTracer tracer, void *data)
20272038
20282039
Register a reference tracer function. The function will be called when a new
@@ -2038,6 +2049,10 @@ Reference tracing
20382049
20392050
There must be an :term:`attached thread state` when calling this function.
20402051
2052+
If another tracer function was already registered, the old function will be
2053+
called with **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED` just before
2054+
the new function is registered.
2055+
20412056
.. versionadded:: 3.13
20422057
20432058
.. c:function:: PyRefTracer PyRefTracer_GetTracer(void** data)

Doc/c-api/init_config.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,11 @@ PyConfig
12781278
12791279
Default: ``0``.
12801280
1281+
.. deprecated-removed:: 3.15 3.17
1282+
1283+
The :option:`-b` and :option:`!-bb` options will become no-op in 3.17.
1284+
:c:member:`~PyConfig.bytes_warning` member will be removed in 3.17.
1285+
12811286
.. c:member:: int warn_default_encoding
12821287
12831288
If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io.TextIOWrapper`

Doc/c-api/sys.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,6 @@ accessible to C code. They all work with the current interpreter thread's
316316
case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``
317317
on error.
318318
319-
.. c:function:: void PySys_ResetWarnOptions()
320-
321-
Reset :data:`sys.warnoptions` to an empty list. This function may be
322-
called prior to :c:func:`Py_Initialize`.
323-
324-
.. deprecated-removed:: 3.13 3.15
325-
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
326-
327319
.. c:function:: void PySys_WriteStdout(const char *format, ...)
328320
329321
Write the output string described by *format* to :data:`sys.stdout`. No

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Pending removal in Python 3.15
5959
Set :c:member:`PyConfig.program_name` instead.
6060
* :c:func:`!Py_SetPythonHome()`:
6161
Set :c:member:`PyConfig.home` instead.
62-
* :c:func:`PySys_ResetWarnOptions`:
62+
* :c:func:`!PySys_ResetWarnOptions`:
6363
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
6464

6565
The :c:func:`Py_InitializeFromConfig` API should be used with

Doc/library/os.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,6 +2630,13 @@ features:
26302630
Compose a raw device number from the major and minor device numbers.
26312631

26322632

2633+
.. data:: NODEV
2634+
2635+
Non-existent device.
2636+
2637+
.. versionadded:: next
2638+
2639+
26332640
.. function:: pathconf(path, name)
26342641

26352642
Return system configuration information relevant to a named file. *name*

Doc/library/sysconfig.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,22 +382,19 @@ Other functions
382382

383383
Examples of returned values:
384384

385-
- linux-i586
386-
- linux-alpha (?)
387-
- solaris-2.6-sun4u
388385

389-
Windows will return one of:
386+
Windows:
390387

391388
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
392389
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
393390
- win32 (all others - specifically, sys.platform is returned)
394391

395-
macOS can return:
392+
POSIX based OS:
396393

397-
- macosx-10.6-ppc
398-
- macosx-10.4-ppc64
399-
- macosx-10.3-i386
400-
- macosx-10.4-fat
394+
- linux-x86_64
395+
- macosx-15.5-arm64
396+
- macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
397+
- android-24-arm64_v8a
401398

402399
For other non-POSIX platforms, currently just returns :data:`sys.platform`.
403400

Doc/reference/compound_stmts.rst

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,29 @@ stored in the :mod:`sys` module is reset to its previous value::
335335
:keyword:`!except*` clause
336336
--------------------------
337337

338-
The :keyword:`!except*` clause(s) are used for handling
339-
:exc:`ExceptionGroup`\s. The exception type for matching is interpreted as in
340-
the case of :keyword:`except`, but in the case of exception groups we can have
341-
partial matches when the type matches some of the exceptions in the group.
342-
This means that multiple :keyword:`!except*` clauses can execute,
343-
each handling part of the exception group.
344-
Each clause executes at most once and handles an exception group
345-
of all matching exceptions. Each exception in the group is handled by at most
346-
one :keyword:`!except*` clause, the first that matches it. ::
338+
The :keyword:`!except*` clause(s) specify one or more handlers for groups of
339+
exceptions (:exc:`BaseExceptionGroup` instances). A :keyword:`try` statement
340+
can have either :keyword:`except` or :keyword:`!except*` clauses, but not both.
341+
The exception type for matching is mandatory in the case of :keyword:`!except*`,
342+
so ``except*:`` is a syntax error. The type is interpreted as in the case of
343+
:keyword:`!except`, but matching is performed on the exceptions contained in the
344+
group that is being handled. An :exc:`TypeError` is raised if a matching
345+
type is a subclass of :exc:`!BaseExceptionGroup`, because that would have
346+
ambiguous semantics.
347+
348+
When an exception group is raised in the try block, each :keyword:`!except*`
349+
clause splits (see :meth:`~BaseExceptionGroup.split`) it into the subgroups
350+
of matching and non-matching exceptions. If the matching subgroup is not empty,
351+
it becomes the handled exception (the value returned from :func:`sys.exception`)
352+
and assigned to the target of the :keyword:`!except*` clause (if there is one).
353+
Then, the body of the :keyword:`!except*` clause executes. If the non-matching
354+
subgroup is not empty, it is processed by the next :keyword:`!except*` in the
355+
same manner. This continues until all exceptions in the group have been matched,
356+
or the last :keyword:`!except*` clause has run.
357+
358+
After all :keyword:`!except*` clauses execute, the group of unhandled exceptions
359+
is merged with any exceptions that were raised or re-raised from within
360+
:keyword:`!except*` clauses. This merged exception group propagates on.::
347361

348362
>>> try:
349363
... raise ExceptionGroup("eg",
@@ -356,22 +370,18 @@ one :keyword:`!except*` clause, the first that matches it. ::
356370
caught <class 'ExceptionGroup'> with nested (TypeError(2),)
357371
caught <class 'ExceptionGroup'> with nested (OSError(3), OSError(4))
358372
+ Exception Group Traceback (most recent call last):
359-
| File "<stdin>", line 2, in <module>
360-
| ExceptionGroup: eg
373+
| File "<doctest default[0]>", line 2, in <module>
374+
| raise ExceptionGroup("eg",
375+
| [ValueError(1), TypeError(2), OSError(3), OSError(4)])
376+
| ExceptionGroup: eg (1 sub-exception)
361377
+-+---------------- 1 ----------------
362378
| ValueError: 1
363379
+------------------------------------
364380

365-
366-
Any remaining exceptions that were not handled by any :keyword:`!except*`
367-
clause are re-raised at the end, along with all exceptions that were
368-
raised from within the :keyword:`!except*` clauses. If this list contains
369-
more than one exception to reraise, they are combined into an exception
370-
group.
371-
372-
If the raised exception is not an exception group and its type matches
373-
one of the :keyword:`!except*` clauses, it is caught and wrapped by an
374-
exception group with an empty message string. ::
381+
If the exception raised from the :keyword:`try` block is not an exception group
382+
and its type matches one of the :keyword:`!except*` clauses, it is caught and
383+
wrapped by an exception group with an empty message string. This ensures that the
384+
type of the target ``e`` is consistently :exc:`BaseExceptionGroup`::
375385

376386
>>> try:
377387
... raise BlockingIOError
@@ -380,13 +390,7 @@ exception group with an empty message string. ::
380390
...
381391
ExceptionGroup('', (BlockingIOError()))
382392

383-
An :keyword:`!except*` clause must have a matching expression; it cannot be ``except*:``.
384-
Furthermore, this expression cannot contain exception group types, because that would
385-
have ambiguous semantics.
386-
387-
It is not possible to mix :keyword:`except` and :keyword:`!except*`
388-
in the same :keyword:`try`.
389-
The :keyword:`break`, :keyword:`continue`, and :keyword:`return` statements
393+
:keyword:`break`, :keyword:`continue` and :keyword:`return`
390394
cannot appear in an :keyword:`!except*` clause.
391395

392396

0 commit comments

Comments
 (0)