Skip to content

Commit 53c06b0

Browse files
committed
Catch up with main
2 parents 02f9b64 + 8b2fb62 commit 53c06b0

31 files changed

+4249
-676
lines changed

.github/workflows/reusable-tsan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ jobs:
7474
run: make pythoninfo
7575
- name: Tests
7676
run: ./python -m test --tsan -j4
77+
- name: Parallel tests
78+
if: fromJSON(inputs.free-threading)
79+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4
7780
- name: Display TSAN logs
7881
if: always()
7982
run: find "${GITHUB_WORKSPACE}" -name 'tsan_log.*' | xargs head -n 1000

.github/workflows/tail-call.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Tail calling interpreter
2+
on:
3+
pull_request:
4+
paths:
5+
- 'Python/bytecodes.c'
6+
- 'Python/ceval.c'
7+
- 'Python/ceval_macros.h'
8+
push:
9+
paths:
10+
- 'Python/bytecodes.c'
11+
- 'Python/ceval.c'
12+
- 'Python/ceval_macros.h'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
env:
23+
FORCE_COLOR: 1
24+
25+
jobs:
26+
tail-call:
27+
name: ${{ matrix.target }}
28+
runs-on: ${{ matrix.runner }}
29+
timeout-minutes: 90
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
target:
34+
# Un-comment as we add support for more platforms for tail-calling interpreters.
35+
# - i686-pc-windows-msvc/msvc
36+
# - x86_64-pc-windows-msvc/msvc
37+
# - aarch64-pc-windows-msvc/msvc
38+
- x86_64-apple-darwin/clang
39+
- aarch64-apple-darwin/clang
40+
- x86_64-unknown-linux-gnu/gcc
41+
- aarch64-unknown-linux-gnu/gcc
42+
llvm:
43+
- 19
44+
include:
45+
# - target: i686-pc-windows-msvc/msvc
46+
# architecture: Win32
47+
# runner: windows-latest
48+
# - target: x86_64-pc-windows-msvc/msvc
49+
# architecture: x64
50+
# runner: windows-latest
51+
# - target: aarch64-pc-windows-msvc/msvc
52+
# architecture: ARM64
53+
# runner: windows-latest
54+
- target: x86_64-apple-darwin/clang
55+
architecture: x86_64
56+
runner: macos-13
57+
- target: aarch64-apple-darwin/clang
58+
architecture: aarch64
59+
runner: macos-14
60+
- target: x86_64-unknown-linux-gnu/gcc
61+
architecture: x86_64
62+
runner: ubuntu-24.04
63+
- target: aarch64-unknown-linux-gnu/gcc
64+
architecture: aarch64
65+
runner: ubuntu-24.04-arm
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
persist-credentials: false
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: '3.11'
73+
74+
- name: Native Windows (debug)
75+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
76+
run: |
77+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
78+
./PCbuild/build.bat --tail-call-interp -d -p ${{ matrix.architecture }}
79+
./PCbuild/rt.bat -d -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
80+
81+
# No tests (yet):
82+
- name: Emulated Windows (release)
83+
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
84+
run: |
85+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
86+
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
87+
88+
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
89+
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
90+
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
91+
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
92+
- name: Native macOS (debug)
93+
if: runner.os == 'macOS'
94+
run: |
95+
brew update
96+
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
97+
brew install llvm@${{ matrix.llvm }}
98+
export SDKROOT="$(xcrun --show-sdk-path)"
99+
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
100+
export PATH="/usr/local/opt/llvm/bin:$PATH"
101+
CC=clang-19 ./configure --with-tail-call-interp --with-pydebug
102+
make all --jobs 4
103+
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
104+
105+
- name: Native Linux (release)
106+
if: runner.os == 'Linux'
107+
run: |
108+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
109+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
110+
CC=clang-19 ./configure --with-tail-call-interp
111+
make all --jobs 4
112+
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
113+

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
15011501
15021502
.. c:function:: PyObject* PyUnstable_InterpreterState_GetMainModule(PyInterpreterState *interp)
15031503
1504-
Return a :term:`strong reference` to the ``__main__`` `module object <moduleobjects>`_
1504+
Return a :term:`strong reference` to the ``__main__`` :ref:`module object <moduleobjects>`
15051505
for the given interpreter.
15061506
15071507
The caller must hold the GIL.

Lib/_markupbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
_markedsectionclose = re.compile(r']\s*]\s*>')
1414

1515
# An analysis of the MS-Word extensions is available at
16-
# http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf
16+
# http://web.archive.org/web/20060321153828/http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf
1717

1818
_msmarkedsectionclose = re.compile(r']\s*>')
1919

Lib/_pyio.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,8 @@ def write(self, b):
937937
return 0
938938
pos = self._pos
939939
if pos > len(self._buffer):
940-
# Inserts null bytes between the current end of the file
941-
# and the new write position.
942-
padding = b'\x00' * (pos - len(self._buffer))
943-
self._buffer += padding
940+
# Pad buffer to pos with null bytes.
941+
self._buffer.resize(pos)
944942
self._buffer[pos:pos + n] = b
945943
self._pos += n
946944
return n

Lib/idlelib/CREDITS.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Major contributors since 2005:
3333

3434
- 2005: Tal Einat
3535
- 2010: Terry Jan Reedy (current maintainer)
36-
- 2013: Roger Serwys
36+
- 2013: Roger Serwy
3737
- 2014: Saimadhav Heblikar
3838
- 2015: Mark Roseman
3939
- 2017: Louie Lu, Cheryl Sabella, and Serhiy Storchaka
4040

4141
For additional details refer to NEWS.txt and Changelog.
4242

43-
Please contact the IDLE maintainer ([email protected]) to have yourself included
44-
here if you are one of those we missed!
43+
If we missed you, feel free to submit a PR with a summary of
44+
contributions (for instance, at least 5 merged PRs).
4545

4646

4747

Lib/idlelib/pyshell.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,8 +1133,7 @@ def ispythonsource(self, filename):
11331133
def short_title(self):
11341134
return self.shell_title
11351135

1136-
COPYRIGHT = \
1137-
'Type "help", "copyright", "credits" or "license()" for more information.'
1136+
SPLASHLINE = 'Enter "help" below or click "Help" above for more information.'
11381137

11391138
def begin(self):
11401139
self.text.mark_set("iomark", "insert")
@@ -1153,7 +1152,7 @@ def begin(self):
11531152
sys.displayhook = rpc.displayhook
11541153

11551154
self.write("Python %s on %s\n%s\n%s" %
1156-
(sys.version, sys.platform, self.COPYRIGHT, nosub))
1155+
(sys.version, sys.platform, self.SPLASHLINE, nosub))
11571156
self.text.focus_force()
11581157
self.showprompt()
11591158
# User code should use separate default Tk root window

Lib/test/libregrtest/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def __init__(self, **kwargs) -> None:
168168
self.pgo = False
169169
self.pgo_extended = False
170170
self.tsan = False
171+
self.tsan_parallel = False
171172
self.worker_json = None
172173
self.start = None
173174
self.timeout = None
@@ -351,6 +352,9 @@ def _create_parser():
351352
help='enable extended PGO training (slower training)')
352353
group.add_argument('--tsan', dest='tsan', action='store_true',
353354
help='run a subset of test cases that are proper for the TSAN test')
355+
group.add_argument('--tsan-parallel', action='store_true',
356+
help='run a subset of test cases that are appropriate '
357+
'for TSAN with `--parallel-threads=N`')
354358
group.add_argument('--fail-env-changed', action='store_true',
355359
help='if a test file alters the environment, mark '
356360
'the test as failed')

Lib/test/libregrtest/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .runtests import RunTests, HuntRefleak
2121
from .setup import setup_process, setup_test_dir
2222
from .single import run_single_test, PROGRESS_MIN_TIME
23-
from .tsan import setup_tsan_tests
23+
from .tsan import setup_tsan_tests, setup_tsan_parallel_tests
2424
from .utils import (
2525
StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
2626
strip_py_suffix, count, format_duration,
@@ -60,6 +60,7 @@ def __init__(self, ns: Namespace, _add_python_opts: bool = False):
6060
self.pgo: bool = ns.pgo
6161
self.pgo_extended: bool = ns.pgo_extended
6262
self.tsan: bool = ns.tsan
63+
self.tsan_parallel: bool = ns.tsan_parallel
6364

6465
# Test results
6566
self.results: TestResults = TestResults()
@@ -195,6 +196,9 @@ def find_tests(self, tests: TestList | None = None) -> tuple[TestTuple, TestList
195196
if self.tsan:
196197
setup_tsan_tests(self.cmdline_args)
197198

199+
if self.tsan_parallel:
200+
setup_tsan_parallel_tests(self.cmdline_args)
201+
198202
exclude_tests = set()
199203
if self.exclude:
200204
for arg in self.cmdline_args:

Lib/test/libregrtest/tsan.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@
2828
'test_free_threading.test_slots',
2929
]
3030

31+
# Tests that should be run with `--parallel-threads=N` under TSAN. These tests
32+
# typically do not use threads, but are run multiple times in parallel by
33+
# the regression test runner with the `--parallel-threads` option enabled.
34+
TSAN_PARALLEL_TESTS = [
35+
'test_abc',
36+
]
37+
3138

3239
def setup_tsan_tests(cmdline_args) -> None:
3340
if not cmdline_args:
3441
cmdline_args[:] = TSAN_TESTS[:]
42+
43+
def setup_tsan_parallel_tests(cmdline_args) -> None:
44+
if not cmdline_args:
45+
cmdline_args[:] = TSAN_PARALLEL_TESTS[:]

0 commit comments

Comments
 (0)