Skip to content

Commit bba6927

Browse files
author
NGRsoftlab
authored
Merge branch 'main' into fix-issue-116180
2 parents cf578bd + 8182319 commit bba6927

File tree

290 files changed

+12027
-8681
lines changed

Some content is hidden

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

290 files changed

+12027
-8681
lines changed

Diff for: .github/workflows/build.yml

+29-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Get a list of the changed documentation-related files
9898
if: github.event_name == 'pull_request'
9999
id: changed-docs-files
100-
uses: Ana06/get-changed-files@v2.2.0
100+
uses: Ana06/get-changed-files@v2.3.0
101101
with:
102102
filter: |
103103
Doc/**
@@ -206,6 +206,8 @@ jobs:
206206
uses: ./.github/workflows/reusable-macos.yml
207207
with:
208208
config_hash: ${{ needs.check_source.outputs.config_hash }}
209+
# macos-14 is M1, macos-13 is Intel
210+
os-matrix: '["macos-14", "macos-13"]'
209211

210212
build_macos_free_threading:
211213
name: 'macOS (free-threading)'
@@ -215,6 +217,8 @@ jobs:
215217
with:
216218
config_hash: ${{ needs.check_source.outputs.config_hash }}
217219
free-threading: true
220+
# macos-14 is M1
221+
os-matrix: '["macos-14"]'
218222

219223
build_ubuntu:
220224
name: 'Ubuntu'
@@ -480,6 +484,24 @@ jobs:
480484
- name: Tests
481485
run: xvfb-run make test
482486

487+
build_tsan:
488+
name: 'Thread sanitizer'
489+
needs: check_source
490+
if: needs.check_source.outputs.run_tests == 'true'
491+
uses: ./.github/workflows/reusable-tsan.yml
492+
with:
493+
config_hash: ${{ needs.check_source.outputs.config_hash }}
494+
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
495+
496+
build_tsan_free_threading:
497+
name: 'Thread sanitizer (free-threading)'
498+
needs: check_source
499+
if: needs.check_source.outputs.run_tests == 'true'
500+
uses: ./.github/workflows/reusable-tsan.yml
501+
with:
502+
config_hash: ${{ needs.check_source.outputs.config_hash }}
503+
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
504+
483505
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
484506
cifuzz:
485507
name: CIFuzz
@@ -492,7 +514,8 @@ jobs:
492514
strategy:
493515
fail-fast: false
494516
matrix:
495-
sanitizer: [address, undefined, memory]
517+
# sanitizer: [address, undefined, memory] -- memory skipped temporarily until GH-116886 is solved.
518+
sanitizer: [address, undefined]
496519
steps:
497520
- name: Build fuzzers (${{ matrix.sanitizer }})
498521
id: build
@@ -538,6 +561,8 @@ jobs:
538561
- build_windows_free_threading
539562
- test_hypothesis
540563
- build_asan
564+
- build_tsan
565+
- build_tsan_free_threading
541566
- cifuzz
542567

543568
runs-on: ubuntu-latest
@@ -571,6 +596,8 @@ jobs:
571596
build_windows,
572597
build_windows_free_threading,
573598
build_asan,
599+
build_tsan,
600+
build_tsan_free_threading,
574601
'
575602
|| ''
576603
}}

Diff for: .github/workflows/jit.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ jobs:
108108
if: runner.os == 'macOS'
109109
run: |
110110
brew install llvm@${{ matrix.llvm }}
111-
export SDKROOT="$(xcrun --show-sdk-path)"
112-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
111+
SDKROOT="$(xcrun --show-sdk-path)" \
112+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
113113
make all --jobs 4
114114
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
115115
@@ -134,10 +134,10 @@ jobs:
134134
sudo apt install --yes "gcc-$HOST" qemu-user
135135
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
136136
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
137-
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
138-
export CPP="$CC --preprocess"
139-
export HOSTRUNNER=qemu-${{ matrix.architecture }}
140137
export QEMU_LD_PREFIX="/usr/$HOST"
141-
./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
138+
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
139+
CPP="$CC --preprocess" \
140+
HOSTRUNNER=qemu-${{ matrix.architecture }} \
141+
./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
142142
make all --jobs 4
143143
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3

Diff for: .github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.x"
26-
- uses: pre-commit/[email protected].0
26+
- uses: pre-commit/[email protected].1

Diff for: .github/workflows/project-updater.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- { project: 32, label: sprint }
2424

2525
steps:
26-
- uses: actions/add-to-project@v0.1.0
26+
- uses: actions/add-to-project@v0.6.0
2727
with:
2828
project-url: https://github.com/orgs/python/projects/${{ matrix.project }}
2929
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}

Diff for: .github/workflows/reusable-macos.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
required: false
99
type: boolean
1010
default: false
11+
os-matrix:
12+
required: false
13+
type: string
1114

1215
jobs:
1316
build_macos:
@@ -22,10 +25,7 @@ jobs:
2225
strategy:
2326
fail-fast: false
2427
matrix:
25-
os: [
26-
"macos-14", # M1
27-
"macos-13", # Intel
28-
]
28+
os: ${{fromJson(inputs.os-matrix)}}
2929
runs-on: ${{ matrix.os }}
3030
steps:
3131
- uses: actions/checkout@v4

Diff for: .github/workflows/reusable-tsan.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
options:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build_tsan_reusable:
13+
name: 'Thread sanitizer'
14+
runs-on: ubuntu-22.04
15+
timeout-minutes: 60
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Runner image version
19+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
20+
- name: Restore config.cache
21+
uses: actions/cache@v4
22+
with:
23+
path: config.cache
24+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
25+
- name: Install Dependencies
26+
run: |
27+
sudo ./.github/workflows/posix-deps-apt.sh
28+
sudo apt install -y clang
29+
# Reduce ASLR to avoid TSAN crashing
30+
sudo sysctl -w vm.mmap_rnd_bits=28
31+
- name: TSAN Option Setup
32+
run: |
33+
echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/Tools/tsan/supressions.txt" >> $GITHUB_ENV
34+
echo "CC=clang" >> $GITHUB_ENV
35+
echo "CXX=clang++" >> $GITHUB_ENV
36+
- name: Add ccache to PATH
37+
run: |
38+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
39+
- name: Configure ccache action
40+
uses: hendrikmuhs/[email protected]
41+
with:
42+
save: ${{ github.event_name == 'push' }}
43+
max-size: "200M"
44+
- name: Configure CPython
45+
run: ${{ inputs.options }}
46+
- name: Build CPython
47+
run: make -j4
48+
- name: Display build info
49+
run: make pythoninfo
50+
- name: Tests
51+
run: ./python -m test --tsan -j4

Diff for: .github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Mark stale pull requests
22

33
on:
44
schedule:
5-
- cron: "0 */12 * * *"
5+
- cron: "0 */6 * * *"
66

77
permissions:
88
pull-requests: write

Diff for: .gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Lib/test/data/*
6969
/_bootstrap_python
7070
/Makefile
7171
/Makefile.pre
72-
iOSTestbed.*
72+
/iOSTestbed.*
7373
iOS/Frameworks/
7474
iOS/Resources/Info.plist
7575
iOS/testbed/build
@@ -142,7 +142,6 @@ Tools/unicode/data/
142142
/profile-clean-stamp
143143
/profile-run-stamp
144144
/profile-bolt-stamp
145-
/Python/deepfreeze/*.c
146145
/pybuilddir.txt
147146
/pyconfig.h
148147
/python-config

Diff for: Doc/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ venv:
163163
echo "venv already exists."; \
164164
echo "To recreate it, remove it first with \`make clean-venv'."; \
165165
else \
166+
echo "Creating venv in $(VENVDIR)"; \
166167
$(PYTHON) -m venv $(VENVDIR); \
167168
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
168169
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \

Diff for: Doc/c-api/code.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ bound into a function.
3434
3535
Return the number of free variables in a code object.
3636
37-
.. c:function:: int PyCode_GetFirstFree(PyCodeObject *co)
37+
.. c:function:: int PyUnstable_Code_GetFirstFree(PyCodeObject *co)
3838
3939
Return the position of the first free variable in a code object.
4040
41+
.. versionchanged:: 3.13
42+
43+
Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`.
44+
The old name is deprecated, but will remain available until the
45+
signature changes again.
46+
4147
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
4248
4349
Return a new code object. If you need a dummy code object to create a frame,

Diff for: Doc/c-api/type.rst

+15
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,21 @@ Type Objects
185185
186186
.. versionadded:: 3.11
187187
188+
.. c:function:: PyObject* PyType_GetFullyQualifiedName(PyTypeObject *type)
189+
190+
Return the type's fully qualified name. Equivalent to
191+
``f"{type.__module__}.{type.__qualname__}"``, or ``type.__qualname__`` if
192+
``type.__module__`` is not a string or is equal to ``"builtins"``.
193+
194+
.. versionadded:: 3.13
195+
196+
.. c:function:: PyObject* PyType_GetModuleName(PyTypeObject *type)
197+
198+
Return the type's module name. Equivalent to getting the ``type.__module__``
199+
attribute.
200+
201+
.. versionadded:: 3.13
202+
188203
.. c:function:: void* PyType_GetSlot(PyTypeObject *type, int slot)
189204
190205
Return the function pointer stored in the given slot. If the

Diff for: Doc/c-api/unicode.rst

+23
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,26 @@ APIs:
518518
- :c:expr:`PyObject*`
519519
- The result of calling :c:func:`PyObject_Repr`.
520520
521+
* - ``T``
522+
- :c:expr:`PyObject*`
523+
- Get the fully qualified name of an object type;
524+
call :c:func:`PyType_GetFullyQualifiedName`.
525+
526+
* - ``T#``
527+
- :c:expr:`PyObject*`
528+
- Similar to ``T`` format, but use a colon (``:``) as separator between
529+
the module name and the qualified name.
530+
531+
* - ``N``
532+
- :c:expr:`PyTypeObject*`
533+
- Get the fully qualified name of a type;
534+
call :c:func:`PyType_GetFullyQualifiedName`.
535+
536+
* - ``N#``
537+
- :c:expr:`PyTypeObject*`
538+
- Similar to ``N`` format, but use a colon (``:``) as separator between
539+
the module name and the qualified name.
540+
521541
.. note::
522542
The width formatter unit is number of characters rather than bytes.
523543
The precision formatter unit is number of bytes or :c:type:`wchar_t`
@@ -553,6 +573,9 @@ APIs:
553573
In previous versions it caused all the rest of the format string to be
554574
copied as-is to the result string, and any extra arguments discarded.
555575
576+
.. versionchanged:: 3.13
577+
Support for ``%T``, ``%T#``, ``%N`` and ``%N#`` formats added.
578+
556579
557580
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
558581

Diff for: Doc/data/stable_abi.dat

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Doc/library/asyncio-eventloop.rst

+25
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,31 @@ Do not instantiate the :class:`Server` class directly.
16411641
coroutine to wait until the server is closed (and no more
16421642
connections are active).
16431643

1644+
.. method:: close_clients()
1645+
1646+
Close all existing incoming client connections.
1647+
1648+
Calls :meth:`~asyncio.BaseTransport.close` on all associated
1649+
transports.
1650+
1651+
:meth:`close` should be called before :meth:`close_clients` when
1652+
closing the server to avoid races with new clients connecting.
1653+
1654+
.. versionadded:: 3.13
1655+
1656+
.. method:: abort_clients()
1657+
1658+
Close all existing incoming client connections immediately,
1659+
without waiting for pending operations to complete.
1660+
1661+
Calls :meth:`~asyncio.WriteTransport.abort` on all associated
1662+
transports.
1663+
1664+
:meth:`close` should be called before :meth:`abort_clients` when
1665+
closing the server to avoid races with new clients connecting.
1666+
1667+
.. versionadded:: 3.13
1668+
16441669
.. method:: get_loop()
16451670

16461671
Return the event loop associated with the server object.

Diff for: Doc/library/ctypes.rst

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Accessing functions from loaded dlls
9393

9494
Functions are accessed as attributes of dll objects::
9595

96-
>>> from ctypes import *
9796
>>> libc.printf
9897
<_FuncPtr object at 0x...>
9998
>>> print(windll.kernel32.GetModuleHandleA) # doctest: +WINDOWS

Diff for: Doc/library/doctest.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,10 @@ Simple example::
430430
>>> [1, 2, 3].remove(42)
431431
Traceback (most recent call last):
432432
File "<stdin>", line 1, in <module>
433-
ValueError: 42 is not in list
433+
ValueError: list.remove(x): x not in list
434434

435-
That doctest succeeds if :exc:`ValueError` is raised, with the ``42 is not in list``
436-
detail as shown.
435+
That doctest succeeds if :exc:`ValueError` is raised, with the ``list.remove(x):
436+
x not in list`` detail as shown.
437437

438438
The expected output for an exception must start with a traceback header, which
439439
may be either of the following two lines, indented the same as the first line of

Diff for: Doc/library/glob.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ The :mod:`glob` module defines the following functions:
136136
separators, and ``*`` pattern segments match precisely one path segment.
137137

138138
If *recursive* is true, the pattern segment "``**``" will match any number
139-
of path segments. If "``**``" occurs in any position other than a full
140-
pattern segment, :exc:`ValueError` is raised.
139+
of path segments.
141140

142141
If *include_hidden* is true, wildcards can match path segments that start
143142
with a dot (``.``).

0 commit comments

Comments
 (0)