Skip to content

Commit db0d614

Browse files
Merge branch 'main' into move-comment
2 parents 59e70e0 + 406ffb5 commit db0d614

File tree

289 files changed

+5805
-2229
lines changed

Some content is hidden

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

289 files changed

+5805
-2229
lines changed

.github/workflows/jit.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8+
- '!Python/perf_jit_trampoline.c'
9+
- '!**/*.md'
10+
- '!**/*.ini'
811
push:
912
paths:
1013
- '**jit**'
1114
- 'Python/bytecodes.c'
1215
- 'Python/optimizer*.c'
16+
- '!Python/perf_jit_trampoline.c'
17+
- '!**/*.md'
18+
- '!**/*.ini'
1319
workflow_dispatch:
1420

1521
permissions:
@@ -144,3 +150,21 @@ jobs:
144150
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations ' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
145151
make all --jobs 4
146152
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
153+
154+
jit-with-disabled-gil:
155+
name: Free-Threaded (Debug)
156+
runs-on: ubuntu-latest
157+
steps:
158+
- uses: actions/checkout@v4
159+
- uses: actions/setup-python@v5
160+
with:
161+
python-version: '3.11'
162+
- name: Build with JIT enabled and GIL disabled
163+
run: |
164+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh 18
165+
export PATH="$(llvm-config-18 --bindir):$PATH"
166+
./configure --enable-experimental-jit --with-pydebug --disable-gil
167+
make all --jobs 4
168+
- name: Run tests
169+
run: |
170+
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ concurrency:
3434
jobs:
3535
mypy:
3636
strategy:
37+
fail-fast: false
3738
matrix:
3839
target: [
3940
"Lib/_pyrepl",

.github/workflows/reusable-docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
python Doc/tools/check-warnings.py \
6363
--annotate-diff '${{ env.branch_base }}' '${{ env.branch_pr }}' \
6464
--fail-if-regression \
65-
--fail-if-improved
65+
--fail-if-improved \
66+
--fail-if-new-news-nit
6667
6768
# This build doesn't use problem matchers or check annotations
6869
build_doc_oldest_supported_sphinx:

Doc/c-api/dict.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Dictionary Objects
191191
to both *default_value* and *\*result* (if it's not ``NULL``).
192192
These may refer to the same object: in that case you hold two separate
193193
references to it.
194+
194195
.. versionadded:: 3.13
195196
196197

Doc/c-api/frame.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,18 @@ See also :ref:`Reflection <reflection>`.
121121
.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)
122122
123123
Get the *frame*'s :attr:`~frame.f_locals` attribute.
124-
If the frame refers to a function or comprehension, this returns
125-
a write-through proxy object that allows modifying the locals.
126-
In all other cases (classes, modules) it returns the :class:`dict`
127-
representing the frame locals directly.
124+
If the frame refers to an :term:`optimized scope`, this returns a
125+
write-through proxy object that allows modifying the locals.
126+
In all other cases (classes, modules, :func:`exec`, :func:`eval`) it returns
127+
the mapping representing the frame locals directly (as described for
128+
:func:`locals`).
128129
129130
Return a :term:`strong reference`.
130131
131132
.. versionadded:: 3.11
132133
133134
.. versionchanged:: 3.13
134-
Return a proxy object for functions and comprehensions.
135+
As part of :pep:`667`, return a proxy object for optimized scopes.
135136
136137
137138
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)

Doc/c-api/hash.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
2929

3030
.. versionadded:: 3.13
3131

32+
.. c:macro:: PyHASH_MULTIPLIER
33+
34+
Prime multiplier used in string and various other hashes.
35+
36+
.. versionadded:: 3.13
37+
3238
.. c:macro:: PyHASH_INF
3339
3440
The hash value returned for a positive infinity.

Doc/c-api/module.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,14 @@ The available slot types are:
427427
This slot is ignored by Python builds not configured with
428428
:option:`--disable-gil`. Otherwise, it determines whether or not importing
429429
this module will cause the GIL to be automatically enabled. See
430-
:envvar:`PYTHON_GIL` and :option:`-X gil <-X>` for more detail.
430+
:ref:`free-threaded-cpython` for more detail.
431431
432432
Multiple ``Py_mod_gil`` slots may not be specified in one module definition.
433433
434434
If ``Py_mod_gil`` is not specified, the import machinery defaults to
435435
``Py_MOD_GIL_USED``.
436436
437-
.. versionadded: 3.13
437+
.. versionadded:: 3.13
438438
439439
See :PEP:`489` for more details on multi-phase initialization.
440440

Doc/c-api/monitoring.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ See :mod:`sys.monitoring` for descriptions of the events.
121121
:c:func:`PyErr_GetRaisedException`).
122122
123123
124-
.. c:function:: int PyMonitoring_FireStopIterationEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset)
124+
.. c:function:: int PyMonitoring_FireStopIterationEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *value)
125125
126-
Fire a ``STOP_ITERATION`` event with the current exception (as returned by
127-
:c:func:`PyErr_GetRaisedException`).
126+
Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:`StopIteration`, it is used. Otherwise,
127+
a new :exc:`StopIteration` instance is created with ``value`` as its argument.
128128
129129
130130
Managing the Monitoring State

Doc/glossary.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,15 @@ Glossary
889889
(methods). Also the ultimate base class of any :term:`new-style
890890
class`.
891891

892+
optimized scope
893+
A scope where target local variable names are reliably known to the
894+
compiler when the code is compiled, allowing optimization of read and
895+
write access to these names. The local namespaces for functions,
896+
generators, coroutines, comprehensions, and generator expressions are
897+
optimized in this fashion. Note: most interpreter optimizations are
898+
applied to all scopes, only those relying on a known set of local
899+
and nonlocal variable names are restricted to optimized scopes.
900+
892901
package
893902
A Python :term:`module` which can contain submodules or recursively,
894903
subpackages. Technically, a package is a Python module with a

Doc/library/ast.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,20 @@ effects on the compilation of a program:
24722472
.. versionadded:: 3.8
24732473

24742474

2475+
.. function:: compare(a, b, /, *, compare_attributes=False)
2476+
2477+
Recursively compares two ASTs.
2478+
2479+
*compare_attributes* affects whether AST attributes are considered
2480+
in the comparison. If *compare_attributes* is ``False`` (default), then
2481+
attributes are ignored. Otherwise they must all be equal. This
2482+
option is useful to check whether the ASTs are structurally equal but
2483+
differ in whitespace or similar details. Attributes include line numbers
2484+
and column offsets.
2485+
2486+
.. versionadded:: 3.14
2487+
2488+
24752489
.. _ast-cli:
24762490

24772491
Command-Line Usage

0 commit comments

Comments
 (0)