8000 Merge branch 'python:main' into pprint_dict_view · python/cpython@7009887 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7009887

Browse files
authored
Merge branch 'python:main' into pprint_dict_view
2 parents ee7b521 + 02cb5fd commit 7009887

File tree

863 files changed

+31950
-18148
lines changed

Some content is hidden

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

863 files changed

+31950
-18148
lines changed

.github/CODEOWNERS

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
# Build system
1515
configure* @erlend-aasland @corona10
16+
Makefile.pre.in @erlend-aasland
17+
Modules/Setup* @erlend-aasland
1618

1719
# asyncio
1820
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
@@ -34,11 +36,13 @@ Python/ceval*.h @markshannon
3436
Python/compile.c @markshannon @iritkatriel
3537
Python/assemble.c @markshannon @iritkatriel
3638
Python/flowgraph.c @markshannon @iritkatriel
39+
Python/instruction_sequence.c @iritkatriel
3740
Python/ast_opt.c @isidentical
3841
Python/bytecodes.c @markshannon
3942
Python/optimizer*.c @markshannon
4043
Python/optimizer_analysis.c @Fidget-Spinner
4144
Python/optimizer_bytecodes.c @Fidget-Spinner
45+
Python/symtable.c @JelleZijlstra @carljm
4246
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
4347
Lib/test/test_patma.py @brandtbucher
4448
Lib/test/test_type_*.py @JelleZijlstra
@@ -74,11 +78,8 @@ Programs/python.c @ericsnowcurrently
7478
Tools/build/generate_global_objects.py @ericsnowcurrently
7579

7680
# Exceptions
77-
Lib/traceback.py @iritkatriel
7881
Lib/test/test_except*.py @iritkatriel
79-
Lib/test/test_traceback.py @iritkatriel
8082
Objects/exceptions.c @iritkatriel
81-
Python/traceback.c @iritkatriel
8283

8384
# Hashing
8485
**/*hashlib* @gpshead @tiran
@@ -155,10 +156,10 @@ Include/internal/pycore_time.h @pganssle @abalkin
155156
/Tools/cases_generator/ @markshannon
156157

157158
# AST
158-
Python/ast.c @isidentical
159-
Parser/asdl.py @isidentical
160-
Parser/asdl_c.py @isidentical
161-
Lib/ast.py @isidentical
159+
Python/ast.c @isidentical @JelleZijlstra
160+
Parser/asdl.py @isidentical @JelleZijlstra
161+
Parser/asdl_c.py @isidentical @JelleZijlstra
162+
Lib/ast.py @isidentical @JelleZijlstra
162163

163164
# Mock
164165
/Lib/unittest/mock.py @cjw296
@@ -175,6 +176,10 @@ Lib/ast.py @isidentical
175176
/Lib/test/test_subprocess.py @gpshead
176177
/Modules/*subprocess* @gpshead
177178

179+
# debugger
180+
**/*pdb* @gaogaotiantian
181+
**/*bdb* @gaogaotiantian
182+
178183
# Limited C API & stable ABI
179184
Tools/build/stable_abi.py @encukou
180185
Misc/stable_abi.toml @encukou
@@ -196,7 +201,6 @@ Doc/c-api/stable.rst @encukou
196201
**/*itertools* @rhettinger
197202
**/*collections* @rhettinger
198203
**/*random* @rhettinger
199-
**/*queue* @rhettinger
200204
**/*bisect* @rhettinger
201205
**/*heapq* @rhettinger
202206
**/*functools* @rhettinger
@@ -207,6 +211,7 @@ Doc/c-api/stable.rst @encukou
207211
**/*ensurepip* @pfmoore @pradyunsg
208212

209213
**/*idlelib* @terryjreedy
214+
/Doc/library/idle.rst @terryjreedy
210215

211216
**/*typing* @JelleZijlstra @AlexWaygood
212217

@@ -242,7 +247,7 @@ Doc/howto/clinic.rst @erlend-aasland
242247
**/*interpreteridobject.* @ericsnowcurrently
243248
**/*crossinterp* @ericsnowcurrently
244249
Lib/test/support/interpreters/ @ericsnowcurrently
245-
Modules/_xx*interp*module.c @ericsnowcurrently
250+
Modules/_interp*module.c @ericsnowcurrently
246251
Lib/test/test_interpreters/ @ericsnowcurrently
247252

248253
# Android

.github/workflows/build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
# into the PR branch anyway.
5555
#
5656
# https://github.com/python/core-workflow/issues/373
57-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
57+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
5858
fi
5959
6060
# Check if we should run hypothesis tests
@@ -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/jit.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,15 @@ jobs:
133133
make all --jobs 4
134134
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
135135
136-
# --with-lto has been removed temporarily as a result of an open issue in LLVM 18 (see https://github.com/llvm/llvm-project/issues/87553)
137136
- name: Native Linux
138137
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
139138
run: |
140139
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
141140
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
142-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations' }}
141+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
143142 10000
make all --jobs 4
144143
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
145144
146-
# --with-lto has been removed temporarily as a result of an open issue in LLVM 18 (see https://github.com/llvm/llvm-project/issues/87553)
147145
- name: Emulated Linux
148146
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
149147
# The --ignorefile on ./python -m test is used to exclude tests known to fail when running on an emulated Linux.
@@ -161,7 +159,7 @@ jobs:
161159
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
162160
CPP="$CC --preprocess" \
163161
HOSTRUNNER=qemu-${{ matrix.architecture }} \
164-
./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
162+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --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
165163
make all --jobs 4
166164
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
167165

.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

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ build:
2626
exit 183;
2727
fi
2828
29+
- asdf plugin add uv
30+
- asdf install uv latest
31+
- asdf global uv latest
2932
- make -C Doc venv html
3033
- mkdir _readthedocs
3134
- mv Doc/build/html _readthedocs/html

Doc/Makefile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ htmlview: html
152152

153153
.PHONY: ensure-sphinx-autobuild
154154
ensure-sphinx-autobuild: venv
155-
$(VENVDIR)/bin/sphinx-autobuild --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install sphinx-autobuild
155+
$(call ensure_package,sphinx-autobuild)
156156

157157
.PHONY: htmllive
158158
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
@@ -174,10 +174,15 @@ venv:
174174
echo "To recreate it, remove it first with \`make clean-venv'."; \
175175
else \
176176
echo "Creating venv in $(VENVDIR)"; \
177-
$(PYTHON) -m venv $(VENVDIR); \
178-
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
179-
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
180-
echo "The venv has been created in the $(VENVDIR) directory"; \
177+
if uv --version > /dev/null; then \
178+
uv venv $(VENVDIR); \
179+
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \
180+
else \
181+
$(PYTHON) -m venv $(VENVDIR); \
182+
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
183+
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
184+
echo "The venv has been created in the $(VENVDIR) directory"; \
185+
fi; \
181186
fi
182187

183188
.PHONY: dist
@@ -235,9 +240,17 @@ dist:
235240
rm -r dist/python-$(DISTVERSION)-docs-texinfo
236241
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
237242

243+
define ensure_package
244+
if uv --version > /dev/null; then \
245+
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
246+
else \
247+
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
248+
fi
249+
endef
250+
238251
.PHONY: check
239252
check: venv
240-
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
253+
$(call ensure_package,pre_commit)
241254
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
242255

243256
.PHONY: serve

Doc/README.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install the tools into there.
2828
Using make
2929
----------
3030

31-
To get started on UNIX, you can create a virtual environment and build
31+
To get started on Unix, you can create a virtual environment and build
3232
documentation with the commands::
3333

3434
make venv
@@ -40,13 +40,13 @@ If you'd like to create the virtual environment in a different location,
4040
you can specify it using the ``VENVDIR`` variable.
4141

4242
You can also skip creating the virtual environment altogether, in which case
43-
the Makefile will look for instances of ``sphinx-build`` and ``blurb``
43+
the ``Makefile`` will look for instances of ``sphinx-build`` and ``blurb``
4444
installed on your process ``PATH`` (configurable with the ``SPHINXBUILD`` and
4545
``BLURB`` variables).
4646

47-
On Windows, we try to emulate the Makefile as closely as possible with a
47+
On Windows, we try to emulate the ``Makefile`` as closely as possible with a
4848
``make.bat`` file. If you need to specify the Python interpreter to use,
49-
set the PYTHON environment variable.
49+
set the ``PYTHON`` environment variable.
5050

5151
Available make targets are:
5252

@@ -62,15 +62,19 @@ Available make targets are:
6262
* "htmlview", which re-uses the "html" builder, but then opens the main page
6363
in your default web browser.
6464

65+
* "htmllive", which re-uses the "html" builder, rebuilds the docs,
66+
starts a local server, and automatically reloads the page in your browser
67+
when you make changes to reST files (Unix only).
68+
6569
* "htmlhelp", which builds HTML files and a HTML Help project file usable to
6670
convert them into a single Compiled HTML (.chm) file -- these are popular
6771
under Microsoft Windows, but very handy on every platform.
6872

6973
To create the CHM file, you need to run the Microsoft HTML Help Workshop
70-
over the generated project (.hhp) file. The make.bat script does this for
74+
over the generated project (.hhp) file. The ``make.bat`` script does this for
7175
you on Windows.
7276

73-
* "latex", which builds LaTeX source files as input to "pdflatex" to produce
77+
* "latex", which builds LaTeX source files as input to ``pdflatex`` to produce
7478
PDF documents.
7579

7680
* "text", which builds a plain text file for each source file.
@@ -95,8 +99,6 @@ Available make targets are:
9599

96100
* "check", which checks for frequent markup errors.
97101

98-
* "serve", which serves the build/html directory on port 8000.
99-
100102
* "dist", (Unix only) which creates distributable archives of HTML, text,
101103
PDF, and EPUB builds.
102104

Doc/c-api/dict.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,17 @@ Dictionary Objects
290290
Py_DECREF(o);
291291
}
292292
293+
The function is not thread-safe in the :term:`free-threaded <free threading>`
294+
build without external synchronization. You can use
295+
:c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating
296+
over it::
297+
298+
Py_BEGIN_CRITICAL_SECTION(self->dict);
299+
while (PyDict_Next(self->dict, &pos, &key, &value)) {
300+
...
301+
}
302+
Py_END_CRITICAL_SECTION();
303+
293304
294305
.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
295306

0 commit comments

Comments
 (0)
0