Skip to content

Commit 2e752fc

Browse files
committed
Merge branch 'main' into use-stackrefs
2 parents 1069d98 + 487fdbe commit 2e752fc

Some content is hidden

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

59 files changed

+858
-521
lines changed

.github/workflows/reusable-windows-msi.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ jobs:
2424
with:
2525
persist-credentials: false
2626
- name: Build CPython installer
27-
run: .\Tools\msi\build.bat --doc -"${ARCH}"
27+
run: ./Tools/msi/build.bat --doc -"${ARCH}"
28+
shell: bash

Doc/c-api/frame.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,34 @@ See also :ref:`Reflection <reflection>`.
132132
.. versionadded:: 3.11
133133
134134
.. versionchanged:: 3.13
135-
As part of :pep:`667`, return a proxy object for optimized scopes.
135+
As part of :pep:`667`, return an instance of :c:var:`PyFrameLocalsProxy_Type`.
136136
137137
138138
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
139139
140140
Return the line number that *frame* is currently executing.
141141
142142
143+
Frame Locals Proxies
144+
^^^^^^^^^^^^^^^^^^^^
145+
146+
.. versionadded:: 3.13
147+
148+
The :attr:`~frame.f_locals` attribute on a :ref:`frame object <frame-objects>`
149+
is an instance of a "frame-locals proxy". The proxy object exposes a
150+
write-through view of the underlying locals dictionary for the frame. This
151+
ensures that the variables exposed by ``f_locals`` are always up to date with
152+
the live local variables in the frame itself.
153+
154+
See :pep:`667` for more information.
155+
156+
.. c:var:: PyTypeObject PyFrameLocalsProxy_Type
157+
158+
The type of frame :func:`locals` proxy objects.
159+
160+
.. c:function:: int PyFrameLocalsProxy_Check(PyObject *obj)
161+
162+
Return non-zero if *obj* is a frame :func:`locals` proxy.
143163
144164
Internal Frames
145165
^^^^^^^^^^^^^^^

Doc/c-api/init.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,15 @@ Initializing and finalizing the interpreter
567567
customized Python that always runs in isolated mode using
568568
:c:func:`Py_RunMain`.
569569
570+
.. c:function:: int PyUnstable_AtExit(PyInterpreterState *interp, void (*func)(void *), void *data)
571+
572+
Register an :mod:`atexit` callback for the target interpreter *interp*.
573+
This is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and
574+
data pointer for the callback.
575+
576+
The :term:`GIL` must be held for *interp*.
577+
578+
.. versionadded:: 3.13
570579
571580
Process-wide parameters
572581
=======================

Doc/c-api/init_config.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,8 @@ PyConfig
12901290
12911291
Default: ``0`` (don't use system log).
12921292
1293+
.. versionadded:: 3.13.2
1294+
12931295
.. c:member:: int user_site_directory
12941296
12951297
If non-zero, add the user site directory to :data:`sys.path`.

Doc/c-api/sys.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,7 @@ Process Control
426426
function registered last is called first. Each cleanup function will be called
427427
at most once. Since Python's internal finalization will have completed before
428428
the cleanup function, no Python APIs should be called by *func*.
429+
430+
.. seealso::
431+
432+
:c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument.

Doc/library/itertools.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ The following recipes have a more mathematical flavor:
10151015
.. testcode::
10161016

10171017
def powerset(iterable):
1018-
"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
1018+
# powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
10191019
s = list(iterable)
10201020
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
10211021

@@ -1104,11 +1104,6 @@ The following recipes have a more mathematical flavor:
11041104
data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
11051105
yield from iter_index(data, 1, start=3)
11061106

1107-
def is_prime(n):
1108-
"Return True if n is prime."
1109-
# is_prime(1_000_000_000_000_403) → True
1110-
return n > 1 and all(n % p for p in sieve(math.isqrt(n) + 1))
1111-
11121107
def factor(n):
11131108
"Prime factors of n."
11141109
# factor(99) → 3 3 11
@@ -1123,6 +1118,11 @@ The following recipes have a more mathematical flavor:
11231118
if n > 1:
11241119
yield n
11251120

1121+
def is_prime(n):
1122+
"Return True if n is prime."
1123+
# is_prime(1_000_000_000_000_403) → True
1124+
return n > 1 and next(factor(n)) == n
1125+
11261126
def totient(n):
11271127
"Count of natural numbers up to n that are coprime to n."
11281128
# https://mathworld.wolfram.com/TotientFunction.html

Doc/library/threading.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,18 @@ since it is impossible to detect the termination of alien threads.
434434
Multiple threads may be given the same name. The initial name is set by
435435
the constructor.
436436

437+
On some platforms, the thread name is set at the operating system level
438+
when the thread starts, so that it is visible in task managers.
439+
This name may be truncated to fit in a system-specific limit (for example,
440+
15 bytes on Linux or 63 bytes on macOS).
441+
442+
Changes to *name* are only reflected at the OS level when the currently
443+
running thread is renamed. (Setting the *name* attribute of a
444+
different thread only updates the Python Thread object.)
445+
446+
.. versionchanged:: 3.14
447+
Set the operating system thread name.
448+
437449
.. method:: getName()
438450
setName()
439451

Doc/library/xmlrpc.client.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ between conformable Python objects and XML on the wire.
6464
The obsolete *use_datetime* flag is similar to *use_builtin_types* but it
6565
applies only to date/time values.
6666

67-
.. versionchanged:: 3.3
68-
The *use_builtin_types* flag was added.
67+
.. versionchanged:: 3.3
68+
The *use_builtin_types* flag was added.
6969

70-
.. versionchanged:: 3.8
71-
The *headers* parameter was added.
70+
.. versionchanged:: 3.8
71+
The *headers* parameter was added.
7272

7373
Both the HTTP and HTTPS transports support the URL syntax extension for HTTP
7474
Basic Authentication: ``http://user:pass@host:port/path``. The ``user:pass``

Include/cpython/tracemalloc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#ifndef Py_LIMITED_API
22
#ifndef Py_TRACEMALLOC_H
33
#define Py_TRACEMALLOC_H
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
47

58
/* Track an allocated memory block in the tracemalloc module.
69
Return 0 on success, return -1 on error (failed to allocate memory to store
@@ -22,5 +25,8 @@ PyAPI_FUNC(int) PyTraceMalloc_Untrack(
2225
unsigned int domain,
2326
uintptr_t ptr);
2427

28+
#ifdef __cplusplus
29+
}
30+
#endif
2531
#endif // !Py_TRACEMALLOC_H
2632
#endif // !Py_LIMITED_API

Include/internal/pycore_atexit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ typedef struct {
4444

4545
struct atexit_state {
4646
atexit_callback *ll_callbacks;
47-
atexit_callback *last_ll_callback;
4847

4948
// XXX The rest of the state could be moved to the atexit module state
5049
// and a low-level callback added for it during module exec.

0 commit comments

Comments
 (0)