Skip to content

Commit dd90c2e

Browse files
committed
Merge branch 'main' into pyrepl/completions-below
2 parents da921c1 + d472b4f commit dd90c2e

File tree

271 files changed

+5522
-2159
lines changed

Some content is hidden

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

271 files changed

+5522
-2159
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/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ help:
3232
@echo " clean to remove build files"
3333
@echo " venv to create a venv with necessary tools"
3434
@echo " html to make standalone HTML files"
35+
@echo " gettext to generate POT files"
3536
@echo " htmlview to open the index page built by the html target in your browser"
3637
@echo " htmllive to rebuild and reload HTML files in your browser"
3738
@echo " htmlhelp to make HTML files and a HTML help project"
@@ -140,6 +141,11 @@ pydoc-topics: build
140141
@echo "Building finished; now run this:" \
141142
"cp build/pydoc-topics/topics.py ../Lib/pydoc_data/topics.py"
142143

144+
.PHONY: gettext
145+
gettext: BUILDER = gettext
146+
gettext: SPHINXOPTS += '-d build/doctrees-gettext'
147+
gettext: build
148+
143149
.PHONY: htmlview
144150
htmlview: html
145151
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"

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/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@
374374
# Split the index
375375
html_split_index = True
376376

377+
# Split pot files one per reST file
378+
gettext_compact = False
377379

378380
# Options for LaTeX output
379381
# ------------------------

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

Doc/library/code.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ build applications which provide an interactive interpreter prompt.
1818
This class deals with parsing and interpreter state (the user's namespace); it
1919
does not deal with input buffering or prompting or input file naming (the
2020
filename is always passed in explicitly). The optional *locals* argument
21-
specifies the dictionary in which code will be executed; it defaults to a newly
22-
created dictionary with key ``'__name__'`` set to ``'__console__'`` and key
23-
``'__doc__'`` set to ``None``.
21+
specifies a mapping to use as the namespace in which code will be executed;
22+
it defaults to a newly created dictionary with key ``'__name__'`` set to
23+
``'__console__'`` and key ``'__doc__'`` set to ``None``.
2424

2525

2626
.. class:: InteractiveConsole(locals=None, filename="<console>", local_exit=False)

Doc/library/dataclasses.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ Module contents
185185
- *slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute
186186
will be generated and new class will be returned instead of the original one.
187187
If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError`
188-
is raised.
188+
is raised. Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result in
189+
the following exception being raised:
190+
``TypeError: super(type, obj): obj must be an instance or subtype of type``.
191+
The two-arg :func:`super` is a valid workaround. See :gh:`90562` for full details.
189192

190193
.. versionadded:: 3.10
191194

@@ -615,7 +618,9 @@ methods will raise a :exc:`FrozenInstanceError` when invoked.
615618

616619
There is a tiny performance penalty when using ``frozen=True``:
617620
:meth:`~object.__init__` cannot use simple assignment to initialize fields, and
618-
must use :meth:`!__setattr__`.
621+
must use :meth:`!object.__setattr__`.
622+
623+
.. Make sure to not remove "object" from "object.__setattr__" in the above markup!
619624
620625
.. _dataclasses-inheritance:
621626

Doc/library/dis.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,12 +929,13 @@ iterations of the loop.
929929
Exception representation on the stack now consist of one, not three, items.
930930

931931

932-
.. opcode:: LOAD_ASSERTION_ERROR
932+
.. opcode:: LOAD_COMMON_CONSTANT
933933

934-
Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert`
935-
statement.
934+
Pushes a common constant onto the stack. The interpreter contains a hardcoded
935+
list of constants supported by this instruction. Used by the :keyword:`assert`
936+
statement to load :exc:`AssertionError`.
936937

937-
.. versionadded:: 3.9
938+
.. versionadded:: 3.14
938939

939940

940941
.. opcode:: LOAD_BUILD_CLASS

0 commit comments

Comments
 (0)