Skip to content

Commit 5e21e60

Browse files
Merge branch 'main' into agen
2 parents f99c988 + 72c3d2e commit 5e21e60

File tree

741 files changed

+10065
-51639
lines changed

Some content is hidden

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

741 files changed

+10065
-51639
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM docker.io/library/fedora:37
22

33
ENV CC=clang
44

5-
ENV WASI_SDK_VERSION=19
5+
ENV WASI_SDK_VERSION=20
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=7.0.0
9+
ENV WASMTIME_VERSION=9.0.1
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \

.devcontainer/devcontainer.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"-y",
1010
"which",
1111
"zsh",
12-
"fish"
12+
"fish",
13+
// For umask fix below.
14+
"/usr/bin/setfacl"
1315
],
1416
"updateContentCommand": {
1517
// Using the shell for `nproc` usage.
@@ -22,6 +24,11 @@
2224
"html"
2325
]
2426
},
27+
"postCreateCommand": {
28+
// https://github.com/orgs/community/discussions/26026
29+
"umask fix: workspace": ["sudo", "setfacl", "-bnR", "."],
30+
"umask fix: /tmp": ["sudo", "setfacl", "-bnR", "/tmp"]
31+
},
2532
"customizations": {
2633
"vscode": {
2734
"extensions": [
@@ -31,10 +38,10 @@
3138
"maelvalais.autoconf",
3239
// C auto-complete.
3340
"ms-vscode.cpptools",
34-
// To view built docs.
35-
"ms-vscode.live-server"
36-
// https://github.com/microsoft/vscode-python/issues/18073
37-
// "ms-python.python"
41+
// To view HTML build of docs.
42+
"ms-vscode.live-server",
43+
// Python auto-complete.
44+
"ms-python.python"
3845
],
3946
"settings": {
4047
"C_Cpp.default.compilerPath": "/usr/bin/clang",

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*.zip binary
1919

2020
# Specific binary files
21-
Lib/test/sndhdrdata/sndhdr.* binary
2221
PC/classicAppCompat.* binary
2322

2423
# Text files that should not be subject to eol conversion

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Include/pytime.h @pganssle @abalkin
9797
/Tools/peg_generator/ @pablogsal @lysnikolaou
9898
/Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
9999
/Grammar/python.gram @pablogsal @lysnikolaou
100+
/Lib/tokenize.py @pablogsal @lysnikolaou
101+
/Lib/test/test_tokenize.py @pablogsal @lysnikolaou
100102

101103
# AST
102104
Python/ast.c @isidentical

.github/workflows/build.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- 'main'
11+
- '3.12'
1112
- '3.11'
1213
- '3.10'
1314
- '3.9'
@@ -16,6 +17,7 @@ on:
1617
pull_request:
1718
branches:
1819
- 'main'
20+
- '3.12'
1921
- '3.11'
2022
- '3.10'
2123
- '3.9'
@@ -81,6 +83,11 @@ jobs:
8183
if: needs.check_source.outputs.run_tests == 'true'
8284
steps:
8385
- uses: actions/checkout@v3
86+
- name: Restore config.cache
87+
uses: actions/cache@v3
88+
with:
89+
path: config.cache
90+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
8491
- uses: actions/setup-python@v3
8592
- name: Install Dependencies
8693
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -97,7 +104,7 @@ jobs:
97104
- name: Configure CPython
98105
run: |
99106
# Build Python with the libpython dynamic library
100-
./configure --with-pydebug --enable-shared
107+
./configure --config-cache --with-pydebug --enable-shared
101108
- name: Regenerate autoconf files with container image
102109
run: make regen-configure
103110
- name: Build CPython
@@ -178,6 +185,11 @@ jobs:
178185
PYTHONSTRICTEXTENSIONBUILD: 1
179186
steps:
180187
- uses: actions/checkout@v3
188+
- name: Restore config.cache
189+
uses: actions/cache@v3
190+
with:
191+
path: config.cache
192+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
181193
- name: Install Homebrew dependencies
182194
run: brew install pkg-config [email protected] xz gdbm tcl-tk
183195
- name: Configure CPython
@@ -186,6 +198,7 @@ jobs:
186198
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
187199
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
188200
./configure \
201+
--config-cache \
189202
--with-pydebug \
190203
--prefix=/opt/python-dev \
191204
--with-openssl="$(brew --prefix [email protected])"
@@ -238,9 +251,18 @@ jobs:
238251
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
239252
- name: Bind mount sources read-only
240253
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
254+
- name: Restore config.cache
255+
uses: actions/cache@v3
256+
with:
257+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
258+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
241259
- name: Configure CPython out-of-tree
242260
working-directory: ${{ env.CPYTHON_BUILDDIR }}
243-
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
261+
run: |
262+
../cpython-ro-srcdir/configure \
263+
--config-cache \
264+
--with-pydebug \
265+
--with-openssl=$OPENSSL_DIR
244266
- name: Build CPython out-of-tree
245267
working-directory: ${{ env.CPYTHON_BUILDDIR }}
246268
run: make -j4
@@ -271,6 +293,11 @@ jobs:
271293
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
272294
steps:
273295
- uses: actions/checkout@v3
296+
- name: Restore config.cache
297+
uses: actions/cache@v3
298+
with:
299+
path: config.cache
300+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
274301
- name: Register gcc problem matcher
275302
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
276303
- name: Install Dependencies
@@ -295,7 +322,7 @@ jobs:
295322
- name: Configure ccache action
296323
uses: hendrikmuhs/[email protected]
297324
- name: Configure CPython
298-
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
325+
run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
299326
- name: Build CPython
300327
run: make -j4
301328
- name: Display build info
@@ -304,7 +331,7 @@ jobs:
304331
run: ./python Lib/test/ssltests.py
305332

306333
test_hypothesis:
307-
name: "Hypothesis Tests on Ubuntu"
334+
name: "Hypothesis tests on Ubuntu"
308335
runs-on: ubuntu-20.04
309336
timeout-minutes: 60
310337
needs: check_source
@@ -345,9 +372,18 @@ jobs:
345372
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
346373
- name: Bind mount sources read-only
347374
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
375+
- name: Restore config.cache
376+
uses: actions/cache@v3
377+
with:
378+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
379+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
348380
- name: Configure CPython out-of-tree
349381
working-directory: ${{ env.CPYTHON_BUILDDIR }}
350-
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
382+
run: |
383+
../cpython-ro-srcdir/configure \
384+
--config-cache \
385+
--with-pydebug \
386+
--with-openssl=$OPENSSL_DIR
351387
- name: Build CPython out-of-tree
352388
working-directory: ${{ env.CPYTHON_BUILDDIR }}
353389
run: make -j4
@@ -368,6 +404,14 @@ jobs:
368404
echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
369405
echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
370406
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -U hypothesis
407+
- name: 'Restore Hypothesis database'
408+
id: cache-hypothesis-database
409+
uses: actions/cache@v3
410+
with:
411+
path: ./hypothesis
412+
key: hypothesis-database-${{ github.head_ref || github.run_id }}
413+
restore-keys: |
414+
- hypothesis-database-
371415
- name: "Run tests"
372416
working-directory: ${{ env.CPYTHON_BUILDDIR }}
373417
run: |
@@ -388,6 +432,11 @@ jobs:
388432
-x test_subprocess \
389433
-x test_signal \
390434
-x test_sysconfig
435+
- uses: actions/upload-artifact@v3
436+
if: always()
437+
with:
438+
name: hypothesis-example-db
439+
path: .hypothesis/examples/
391440

392441

393442
build_asan:
@@ -402,6 +451,11 @@ jobs:
402451
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
403452
steps:
404453
- uses: actions/checkout@v3
454+
- name: Restore config.cache
455+
uses: actions/cache@v3
456+
with:
457+
path: config.cache
458+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
405459
- name: Register gcc problem matcher
406460
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
407461
- name: Install Dependencies
@@ -430,7 +484,7 @@ jobs:
430484
- name: Configure ccache action
431485
uses: hendrikmuhs/[email protected]
432486
- name: Configure CPython
433-
run: ./configure --with-address-sanitizer --without-pymalloc
487+
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
434488
- name: Build CPython
435489
run: make -j4
436490
- name: Display build info

.github/workflows/build_msi.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ on:
88
- '3.*'
99
paths:
1010
- 'Tools/msi/**'
11+
- '.github/workflows/build_msi.yml'
1112
pull_request:
1213
branches:
1314
- 'main'
1415
- '3.*'
1516
paths:
1617
- 'Tools/msi/**'
18+
- '.github/workflows/build_msi.yml'
1719

1820
permissions:
1921
contents: read
@@ -33,4 +35,4 @@ jobs:
3335
steps:
3436
- uses: actions/checkout@v3
3537
- name: Build CPython installer
36-
run: .\Tools\msi\build.bat -${{ matrix.type }}
38+
run: .\Tools\msi\build.bat --doc -${{ matrix.type }}

.github/workflows/doc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
#push:
66
# branches:
77
# - 'main'
8+
# - '3.12'
89
# - '3.11'
910
# - '3.10'
1011
# - '3.9'
@@ -15,6 +16,7 @@ on:
1516
pull_request:
1617
branches:
1718
- 'main'
19+
- '3.12'
1820
- '3.11'
1921
- '3.10'
2022
- '3.9'

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
*.gc??
2424
*.profclang?
2525
*.profraw
26+
# Copies of binaries before BOLT optimizations.
27+
*.prebolt
28+
# BOLT profile data.
29+
*.fdata
2630
*.dyn
2731
.gdb_history
2832
.purify
@@ -57,7 +61,6 @@ Doc/.venv/
5761
Doc/env/
5862
Doc/.env/
5963
Include/pydtrace_probes.h
60-
Lib/lib2to3/*.pickle
6164
Lib/site-packages/*
6265
!Lib/site-packages/README.txt
6366
Lib/test/data/*
@@ -124,6 +127,7 @@ Tools/unicode/data/
124127
/platform
125128
/profile-clean-stamp
126129
/profile-run-stamp
130+
/profile-bolt-stamp
127131
/Python/deepfreeze/*.c
128132
/pybuilddir.txt
129133
/pyconfig.h

.readthedocs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ build:
1313
python: "3"
1414

1515
commands:
16+
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
17+
#
18+
# Cancel building pull requests when there aren't changes in the Doc directory.
19+
#
20+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
21+
# This is a special exit code on Read the Docs that will cancel the build immediately.
22+
- |
23+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ];
24+
then
25+
echo "No changes to Doc/ - exiting the build.";
26+
exit 183;
27+
fi
28+
1629
- make -C Doc venv html
1730
- mkdir _readthedocs
1831
- mv Doc/build/html _readthedocs/html
32+

Doc/c-api/long.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,27 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
322322
with :c:func:`PyLong_FromVoidPtr`.
323323
324324
Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
325+
326+
327+
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
328+
329+
Return 1 if *op* is compact, 0 otherwise.
330+
331+
This function makes it possible for performance-critical code to implement
332+
a “fast path” for small integers. For compact values use
333+
:c:func:`PyUnstable_Long_CompactValue`; for others fall back to a
334+
:c:func:`PyLong_As* <PyLong_AsSize_t>` function or
335+
:c:func:`calling <PyObject_CallMethod>` :meth:`int.to_bytes`.
336+
337+
The speedup is expected to be negligible for most users.
338+
339+
Exactly what values are considered compact is an implementation detail
340+
and is subject to change.
341+
342+
.. c:function:: Py_ssize_t PyUnstable_Long_CompactValue(const PyLongObject* op)
343+
344+
If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`,
345+
return its value.
346+
347+
Otherwise, the return value is undefined.
348+

0 commit comments

Comments
 (0)