Skip to content

Commit f29168e

Browse files
authored
Merge branch 'main' into pyrepl/completions-below
2 parents c5407d5 + fabcf6b commit f29168e

File tree

361 files changed

+8315
-4746
lines changed

Some content is hidden

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

361 files changed

+8315
-4746
lines changed

.github/CODEOWNERS

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ Python/ceval*.h @markshannon
3434
Python/compile.c @markshannon @iritkatriel
3535
Python/assemble.c @markshannon @iritkatriel
3636
Python/flowgraph.c @markshannon @iritkatriel
37+
Python/instruction_sequence.c @iritkatriel
3738
Python/ast_opt.c @isidentical
3839
Python/bytecodes.c @markshannon
3940
Python/optimizer*.c @markshannon
4041
Python/optimizer_analysis.c @Fidget-Spinner
4142
Python/optimizer_bytecodes.c @Fidget-Spinner
43+
Python/symtable.c @JelleZijlstra @carljm
4244
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
4345
Lib/test/test_patma.py @brandtbucher
4446
Lib/test/test_type_*.py @JelleZijlstra
@@ -74,11 +76,8 @@ Programs/python.c @ericsnowcurrently
7476
Tools/build/generate_global_objects.py @ericsnowcurrently
7577

7678
# Exceptions
77-
Lib/traceback.py @iritkatriel
7879
Lib/test/test_except*.py @iritkatriel
79-
Lib/test/test_traceback.py @iritkatriel
8080
Objects/exceptions.c @iritkatriel
81-
Python/traceback.c @iritkatriel
8281

8382
# Hashing
8483
**/*hashlib* @gpshead @tiran
@@ -155,10 +154,10 @@ Include/internal/pycore_time.h @pganssle @abalkin
155154
/Tools/cases_generator/ @markshannon
156155

157156
# AST
158-
Python/ast.c @isidentical
159-
Parser/asdl.py @isidentical
160-
Parser/asdl_c.py @isidentical
161-
Lib/ast.py @isidentical
157+
Python/ast.c @isidentical @JelleZijlstra
158+
Parser/asdl.py @isidentical @JelleZijlstra
159+
Parser/asdl_c.py @isidentical @JelleZijlstra
160+
Lib/ast.py @isidentical @JelleZijlstra
162161

163162
# Mock
164163
/Lib/unittest/mock.py @cjw296
@@ -175,6 +174,10 @@ Lib/ast.py @isidentical
175174
/Lib/test/test_subprocess.py @gpshead
176175
/Modules/*subprocess* @gpshead
177176

177+
# debugger
178+
**/*pdb* @gaogaotiantian
179+
**/*bdb* @gaogaotiantian
180+
178181
# Limited C API & stable ABI
179182
Tools/build/stable_abi.py @encukou
180183
Misc/stable_abi.toml @encukou
@@ -242,7 +245,7 @@ Doc/howto/clinic.rst @erlend-aasland
242245
**/*interpreteridobject.* @ericsnowcurrently
243246
**/*crossinterp* @ericsnowcurrently
244247
Lib/test/support/interpreters/ @ericsnowcurrently
245-
Modules/_xx*interp*module.c @ericsnowcurrently
248+
Modules/_interp*module.c @ericsnowcurrently
246249
Lib/test/test_interpreters/ @ericsnowcurrently
247250

248251
# Android

.github/workflows/build.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ jobs:
199199
uses: ./.github/workflows/reusable-macos.yml
200200
with:
201201
config_hash: ${{ needs.check_source.outputs.config_hash }}
202-
# macos-14 is M1, macos-13 is Intel
203-
os-matrix: '["macos-14", "macos-13"]'
202+
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
203+
# Cirrus used for upstream, macos-14 for forks.
204+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]'
204205

205206
build_macos_free_threading:
206207
name: 'macOS (free-threading)'
@@ -210,8 +211,9 @@ jobs:
210211
with:
211212
config_hash: ${{ needs.check_source.outputs.config_hash }}
212213
free-threading: true
213-
# macos-14-large is Intel with 12 cores (most parallelism)
214-
os-matrix: '["macos-14"]'
214+
# Cirrus and macos-14 are M1.
215+
# Cirrus used for upstream, macos-14 for forks.
216+
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
215217

216218
build_ubuntu:
217219
name: 'Ubuntu'

.github/workflows/reusable-macos.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
build_macos:
17-
name: 'build and test'
17+
name: build and test (${{ matrix.os }})
1818
timeout-minutes: 60
1919
env:
2020
HOMEBREW_NO_ANALYTICS: 1
@@ -27,6 +27,13 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ${{fromJson(inputs.os-matrix)}}
30+
is-fork:
31+
- ${{ github.repository_owner != 'python' }}
32+
exclude:
33+
- os: "ghcr.io/cirruslabs/macos-runner:sonoma"
34+
is-fork: true
35+
- os: "macos-14"
36+
is-fork: false
3037
runs-on: ${{ matrix.os }}
3138
steps:
3239
- uses: actions/checkout@v4

Doc/c-api/long.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,19 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
494494
.. versionadded:: 3.13
495495
496496
497+
.. c:function:: int PyLong_GetSign(PyObject *obj, int *sign)
498+
499+
Get the sign of the integer object *obj*.
500+
501+
On success, set *\*sign* to the integer sign (0, -1 or +1 for zero, negative or
502+
positive integer, respectively) and return 0.
503+
504+
On failure, return -1 with an exception set. This function always succeeds
505+
if *obj* is a :c:type:`PyLongObject` or its subtype.
506+
507+
.. versionadded:: 3.14
508+
509+
497510
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
498511
499512
Return 1 if *op* is compact, 0 otherwise.

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _monitoring:
44

5-
Monitorong C API
5+
Monitoring C API
66
================
77

88
Added in version 3.13.

Doc/c-api/reflection.rst

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,48 @@ Reflection
77

88
.. c:function:: PyObject* PyEval_GetBuiltins(void)
99
10+
.. deprecated:: 3.13
11+
12+
Use :c:func:`PyEval_GetFrameBuiltins` instead.
13+
1014
Return a dictionary of the builtins in the current execution frame,
1115
or the interpreter of the thread state if no frame is currently executing.
1216
1317
1418
.. c:function:: PyObject* PyEval_GetLocals(void)
1519
16-
Return a dictionary of the local variables in the current execution frame,
20+
.. deprecated:: 3.13
21+
22+
Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as calling
23+
:func:`locals` in Python code, or else call :c:func:`PyFrame_GetLocals` on the result
24+
of :c:func:`PyEval_GetFrame` to access the :attr:`~frame.f_locals` attribute of the
25+
currently executing frame.
26+
27+
Return a mapping providing access to the local variables in the current execution frame,
1728
or ``NULL`` if no frame is currently executing.
1829
30+
Refer to :func:`locals` for details of the mapping returned at different scopes.
31+
32+
As this function returns a :term:`borrowed reference`, the dictionary returned for
33+
:term:`optimized scopes <optimized scope>` is cached on the frame object and will remain
34+
alive as long as the frame object does. Unlike :c:func:`PyEval_GetFrameLocals` and
35+
:func:`locals`, subsequent calls to this function in the same frame will update the
36+
contents of the cached dictionary to reflect changes in the state of the local variables
37+
rather than returning a new snapshot.
38+
39+
.. versionchanged:: 3.13
40+
As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and
41+
:attr:`FrameType.f_locals <frame.f_locals>` no longer make use of the shared cache
42+
dictionary. Refer to the :ref:`What's New entry <whatsnew313-locals-semantics>` for
43+
additional details.
44+
1945
2046
.. c:function:: PyObject* PyEval_GetGlobals(void)
2147
48+
.. deprecated:: 3.13
49+
50+
Use :c:func:`PyEval_GetFrameGlobals` instead.
51+
2252
Return a dictionary of the global variables in the current execution frame,
2353
or ``NULL`` if no frame is currently executing.
2454
@@ -31,6 +61,36 @@ Reflection
3161
See also :c:func:`PyThreadState_GetFrame`.
3262
3363
64+
.. c:function:: PyObject* PyEval_GetFrameBuiltins(void)
65+
66+
Return a dictionary of the builtins in the current execution frame,
67+
or the interpreter of the thread state if no frame is currently executing.
68+
69+
.. versionadded:: 3.13
70+
71+
72+
.. c:function:: PyObject* PyEval_GetFrameLocals(void)
73+
74+
Return a dictionary of the local variables in the current execution frame,
75+
or ``NULL`` if no frame is currently executing. Equivalent to calling
76+
:func:`locals` in Python code.
77+
78+
To access :attr:`~frame.f_locals` on the current frame without making an independent
79+
snapshot in :term:`optimized scopes <optimized scope>`, call :c:func:`PyFrame_GetLocals`
80+
on the result of :c:func:`PyEval_GetFrame`.
81+
82+
.. versionadded:: 3.13
83+
84+
85+
.. c:function:: PyObject* PyEval_GetFrameGlobals(void)
86+
87+
Return a dictionary of the global variables in the current execution frame,
88+
or ``NULL`` if no frame is currently executing. Equivalent to calling
89+
:func:`globals` in Python code.
90+
91+
.. versionadded:: 3.13
92+
93+
3494
.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
3595
3696
Return the name of *func* if it is a function, class or instance object, else the

Doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@
339339
html_context = {
340340
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
341341
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
342-
"pr_id": os.getenv("READTHEDOCS_VERSION")
342+
"pr_id": os.getenv("READTHEDOCS_VERSION"),
343+
"enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
343344
}
344345

345346
# This 'Last updated on:' timestamp is inserted at the bottom of every page.

Doc/data/refcounts.dat

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,12 @@ PyEval_GetGlobals:PyObject*::0:
790790

791791
PyEval_GetFrame:PyObject*::0:
792792

793+
PyEval_GetFrameBuiltins:PyObject*::+1:
794+
795+
PyEval_GetFrameLocals:PyObject*::+1:
796+
797+
PyEval_GetFrameGlobals:PyObject*::+1:
798+
793799
PyEval_GetFuncDesc:const char*:::
794800
PyEval_GetFuncDesc:PyObject*:func:0:
795801

@@ -916,6 +922,32 @@ PyFloat_FromString:PyObject*:str:0:
916922
PyFloat_GetInfo:PyObject*::+1:
917923
PyFloat_GetInfo::void::
918924

925+
PyFrame_GetBack:PyObject*::+1:
926+
PyFrame_GetBack:PyFrameObject*:frame:0:
927+
928+
PyFrame_GetBuiltins:PyObject*::+1:
929+
PyFrame_GetBuiltins:PyFrameObject*:frame:0:
930+
931+
PyFrame_GetCode:PyObject*::+1:
932+
PyFrame_GetCode:PyFrameObject*:frame:0:
933+
934+
PyFrame_GetGenerator:PyObject*::+1:
935+
PyFrame_GetGenerator:PyFrameObject*:frame:0:
936+
937+
PyFrame_GetGlobals:PyObject*::+1:
938+
PyFrame_GetGlobals:PyFrameObject*:frame:0:
939+
940+
PyFrame_GetLocals:PyObject*::+1:
941+
PyFrame_GetLocals:PyFrameObject*:frame:0:
942+
943+
PyFrame_GetVar:PyObject*::+1:
944+
PyFrame_GetVar:PyFrameObject*:frame:0:
945+
PyFrame_GetVar:PyObject*:name:0:
946+
947+
PyFrame_GetVarString:PyObject*::+1:
948+
PyFrame_GetVarString:PyFrameObject*:frame:0:
949+
PyFrame_GetVarString:const char*:name::
950+
919951
PyFrozenSet_Check:int:::
920952
PyFrozenSet_Check:PyObject*:p:0:
921953

Doc/glossary.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ Glossary
438438
division. Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75``
439439
rounded *downward*. See :pep:`238`.
440440

441+
free threading
442+
A threading model where multiple threads can run Python bytecode
443+
simultaneously within the same interpreter. This is in contrast to
444+
the :term:`global interpreter lock` which allows only one thread to
445+
execute Python bytecode at a time. See :pep:`703`.
446+
441447
function
442448
A series of statements which returns some value to a caller. It can also
443449
be passed zero or more :term:`arguments <argument>` which may be used in
@@ -588,7 +594,7 @@ Glossary
588594
therefore it is never deallocated.
589595

590596
Built-in strings and singletons are immortal objects. For example,
591-
:const:`True` and :const:`None` singletons are immmortal.
597+
:const:`True` and :const:`None` singletons are immortal.
592598

593599
See `PEP 683 – Immortal Objects, Using a Fixed Refcount
594600
<https://peps.python.org/pep-0683/>`_ for more information.

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ Invocation from super
787787
---------------------
788788

789789
The logic for super's dotted lookup is in the :meth:`__getattribute__` method for
790-
object returned by :class:`super()`.
790+
object returned by :func:`super`.
791791

792792
A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__``
793793
for the base class ``B`` immediately following ``A`` and then returns

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,7 @@ When run, this produces a file with exactly two lines:
29502950
.. code-block:: none
29512951
29522952
28/01/2015 07:21:23|INFO|Sample message|
2953-
28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: integer division or modulo by zero'|
2953+
28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: division by zero'|
29542954
29552955
While the above treatment is simplistic, it points the way to how exception
29562956
information can be formatted to your liking. The :mod:`traceback` module may be

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The class can be used to simulate nested scopes and is useful in templating.
9999
:func:`super` function. A reference to ``d.parents`` is equivalent to:
100100
``ChainMap(*d.maps[1:])``.
101101

102-
Note, the iteration order of a :class:`ChainMap()` is determined by
102+
Note, the iteration order of a :class:`ChainMap` is determined by
103103
scanning the mappings last to first::
104104

105105
>>> baseline = {'music': 'bach', 'art': 'rembrandt'}

Doc/library/contextlib.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ Functions and classes provided:
314314

315315
If the code within the :keyword:`!with` block raises a
316316
:exc:`BaseExceptionGroup`, suppressed exceptions are removed from the
317-
group. If any exceptions in the group are not suppressed, a group containing them is re-raised.
317+
group. Any exceptions of the group which are not suppressed are re-raised in
318+
a new group which is created using the original group's :meth:`~BaseExceptionGroup.derive`
319+
method.
318320

319321
.. versionadded:: 3.4
320322

@@ -796,7 +798,7 @@ executing that callback::
796798
if result:
797799
stack.pop_all()
798800

799-
This allows the intended cleanup up behaviour to be made explicit up front,
801+
This allows the intended cleanup behaviour to be made explicit up front,
800802
rather than requiring a separate flag variable.
801803

802804
If a particular application uses this pattern a lot, it can be simplified

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ There is one more :class:`tzinfo` method that a subclass may wish to override:
21532153

21542154
.. method:: tzinfo.fromutc(dt)
21552155

2156-
This is called from the default :class:`datetime.astimezone()`
2156+
This is called from the default :meth:`datetime.astimezone`
21572157
implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s
21582158
date and time data are to be viewed as expressing a UTC time. The purpose
21592159
of :meth:`fromutc` is to adjust the date and time data, returning an

0 commit comments

Comments
 (0)