Skip to content

Commit 4cdb3ae

Browse files
Merge branch 'main' into fix-help-double-prompt
* main: (69 commits) Add "annotate" SET_FUNCTION_ATTRIBUTE bit to dis. (python#124566) pythongh-124412: Add helpers for converting annotations to source format (python#124551) pythongh-119180: Disallow instantiation of ConstEvaluator objects (python#124561) For-else deserves its own section in the tutorial (python#123946) Add 3.13 as a version option to the crash issue template (python#124560) pythongh-123242: Note that type.__annotations__ may not exist (python#124557) pythongh-119180: Make FORWARDREF format look at __annotations__ first (python#124479) pythonGH-58058: Add quick reference for `ArgumentParser` to argparse docs (pythongh-124227) pythongh-41431: Add `datetime.time.strptime()` and `datetime.date.strptime()` (python#120752) pythongh-102450: Add ISO-8601 alternative for midnight to `fromisoformat()` calls. (python#105856) pythongh-124370: Add "howto" for free-threaded Python (python#124371) pythongh-121277: Allow `.. versionadded:: next` in docs (pythonGH-121278) pythongh-119400: make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters python#119400 (pythonGH-119401) pythongh-119180: Avoid going through AST and eval() when possible in annotationlib (python#124337) pythongh-124448: Update Windows builds to use Tcl/Tk 8.6.15 (pythonGH-124449) pythongh-123884 Tee of tee was not producing n independent iterators (pythongh-124490) pythongh-124378: Update test_ttk for Tcl/Tk 8.6.15 (pythonGH-124542) pythongh-124513: Check args in framelocalsproxy_new() (python#124515) pythongh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (python#124480) Doc: Use ``major.minor`` for documentation distribution archive filenames (python#124489) ...
2 parents 42559ef + 4defb58 commit 4cdb3ae

File tree

265 files changed

+4338
-1559
lines changed

Some content is hidden

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

265 files changed

+4338
-1559
lines changed

.github/ISSUE_TEMPLATE/crash.yml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
- "3.10"
3333
- "3.11"
3434
- "3.12"
35+
- "3.13"
3536
- "CPython main branch"
3637
validations:
3738
required: true

.github/workflows/build.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ jobs:
195195

196196
build_ubuntu_ssltests:
197197
name: 'Ubuntu SSL tests with OpenSSL'
198-
runs-on: ubuntu-22.04
198+
runs-on: ${{ matrix.os }}
199199
timeout-minutes: 60
200200
needs: check_source
201201
if: needs.check_source.outputs.run_tests == 'true'
202202
strategy:
203203
fail-fast: false
204204
matrix:
205+
os: [ubuntu-22.04]
205206
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
206207
env:
207208
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -231,7 +232,7 @@ jobs:
231232
uses: actions/cache@v4
232233
with:
233234
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
234-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
235+
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
235236
- name: Install OpenSSL
236237
if: steps.cache-openssl.outputs.cache-hit != 'true'
237238
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
@@ -410,7 +411,7 @@ jobs:
410411
uses: actions/cache@v4
411412
with:
412413
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
413-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
414+
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
414415
- name: Install OpenSSL
415416
if: steps.cache-openssl.outputs.cache-hit != 'true'
416417
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux

.github/workflows/jit.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,15 @@ jobs:
110110
- name: Native Windows
111111
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
112112
run: |
113-
choco upgrade llvm -y
114-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
113+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
115114
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
116115
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
117116
118117
# No PGO or tests (yet):
119118
- name: Emulated Windows
120119
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
121120
run: |
122-
choco upgrade llvm -y
123-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
121+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
124122
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
125123
126124
- name: Native macOS
@@ -159,7 +157,7 @@ jobs:
159157
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
160158
CPP="$CC --preprocess" \
161159
HOSTRUNNER=qemu-${{ matrix.architecture }} \
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
160+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--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
163161
make all --jobs 4
164162
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
165163

.github/workflows/reusable-ubuntu.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ jobs:
1414
build_ubuntu_reusable:
1515
name: 'build and test'
1616
timeout-minutes: 60
17-
runs-on: ubuntu-22.04
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-22.04]
1822
env:
1923
FORCE_COLOR: 1
2024
OPENSSL_VER: 3.0.15
@@ -36,7 +40,7 @@ jobs:
3640
uses: actions/cache@v4
3741
with:
3842
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
39-
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
43+
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
4044
- name: Install OpenSSL
4145
if: steps.cache-openssl.outputs.cache-hit != 'true'
4246
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux

.pre-commit-config.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.4.10
3+
rev: v0.6.7
44
hooks:
55
- id: ruff
66
name: Run Ruff (lint) on Doc/
@@ -10,6 +10,10 @@ repos:
1010
name: Run Ruff (lint) on Lib/test/
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Lib/test/
13+
- id: ruff
14+
name: Run Ruff (lint) on Tools/build/check_warnings.py
15+
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
16+
files: ^Tools/build/check_warnings.py
1317
- id: ruff
1418
name: Run Ruff (lint) on Argument Clinic
1519
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
@@ -22,6 +26,11 @@ repos:
2226
- repo: https://github.com/psf/black-pre-commit-mirror
2327
rev: 24.8.0
2428
hooks:
29+
- id: black
30+
name: Run Black on Tools/build/check_warnings.py
31+
files: ^Tools/build/check_warnings.py
32+
language_version: python3.12
33+
args: [--line-length=79]
2534
- id: black
2635
name: Run Black on Tools/jit/
2736
files: ^Tools/jit/

Android/README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Python for Android
22

33
These instructions are only needed if you're planning to compile Python for
4-
Android yourself. Most users should *not* need to do this. If you're looking to
5-
use Python on Android, one of the following tools will provide a much more
6-
approachable user experience:
7-
8-
* [Briefcase](https://briefcase.readthedocs.io), from the BeeWare project
9-
* [Buildozer](https://buildozer.readthedocs.io), from the Kivy project
10-
* [Chaquopy](https://chaquo.com/chaquopy/)
4+
Android yourself. Most users should *not* need to do this. Instead, use one of
5+
the tools listed in `Doc/using/android.rst`, which will provide a much easier
6+
experience.
117

128

139
## Prerequisites
@@ -89,10 +85,10 @@ The test suite can be run on Linux, macOS, or Windows:
8985
The test suite can usually be run on a device with 2 GB of RAM, but this is
9086
borderline, so you may need to increase it to 4 GB. As of Android
9187
Studio Koala, 2 GB is the default for all emulators, although the user interface
92-
may indicate otherwise. The effective setting is `hw.ramSize` in
93-
~/.android/avd/*.avd/hardware-qemu.ini, whereas Android Studio displays the
94-
value from config.ini. Changing the value in Android Studio will update both of
95-
these files.
88+
may indicate otherwise. Locate the emulator's directory under `~/.android/avd`,
89+
and find `hw.ramSize` in both config.ini and hardware-qemu.ini. Either set these
90+
manually to the same value, or use the Android Studio Device Manager, which will
91+
update both files.
9692

9793
Before running the test suite, follow the instructions in the previous section
9894
to build the architecture you want to test. Then run the test script in one of
@@ -133,3 +129,8 @@ Every time you run `android.py test`, changes in pure-Python files in the
133129
repository's `Lib` directory will be picked up immediately. Changes in C files,
134130
and architecture-specific files such as sysconfigdata, will not take effect
135131
until you re-run `android.py make-host` or `build`.
132+
133+
134+
## Using in your own app
135+
136+
See `Doc/using/android.rst`.

Doc/Makefile

+31-1
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,26 @@ venv:
182182
echo "The venv has been created in the $(VENVDIR) directory"; \
183183
fi
184184

185+
.PHONY: dist-no-html
186+
dist-no-html: dist-text dist-pdf dist-epub dist-texinfo
187+
185188
.PHONY: dist
186189
dist:
187190
rm -rf dist
188191
mkdir -p dist
189-
192+
$(MAKE) dist-html
193+
$(MAKE) dist-text
194+
$(MAKE) dist-pdf
195+
$(MAKE) dist-epub
196+
$(MAKE) dist-texinfo
197+
198+
.PHONY: dist-html
199+
dist-html:
190200
# archive the HTML
191201
@echo "Building HTML..."
202+
mkdir -p dist
203+
rm -rf build/html
204+
find dist -name 'python-$(DISTVERSION)-docs-html*' -exec rm -rf {} \;
192205
$(MAKE) html
193206
cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
194207
tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
@@ -198,8 +211,13 @@ dist:
198211
rm dist/python-$(DISTVERSION)-docs-html.tar
199212
@echo "Build finished and archived!"
200213

214+
.PHONY: dist-text
215+
dist-text:
201216
# archive the text build
202217
@echo "Building text..."
218+
mkdir -p dist
219+
rm -rf build/text
220+
find dist -name 'python-$(DISTVERSION)-docs-text*' -exec rm -rf {} \;
203221
$(MAKE) text
204222
cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
205223
tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
@@ -209,9 +227,13 @@ dist:
209227
rm dist/python-$(DISTVERSION)-docs-text.tar
210228
@echo "Build finished and archived!"
211229

230+
.PHONY: dist-pdf
231+
dist-pdf:
212232
# archive the A4 latex
213233
@echo "Building LaTeX (A4 paper)..."
234+
mkdir -p dist
214235
rm -rf build/latex
236+
find dist -name 'python-$(DISTVERSION)-docs-pdf*' -exec rm -rf {} \;
215237
$(MAKE) latex PAPER=a4
216238
# remove zip & bz2 dependency on all-pdf,
217239
# as otherwise the full latexmk process is run twice.
@@ -222,16 +244,24 @@ dist:
222244
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
223245
@echo "Build finished and archived!"
224246

247+
.PHONY: dist-epub
248+
dist-epub:
225249
# copy the epub build
226250
@echo "Building EPUB..."
251+
mkdir -p dist
227252
rm -rf build/epub
253+
rm -f dist/python-$(DISTVERSION)-docs.epub
228254
$(MAKE) epub
229255
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
230256
@echo "Build finished and archived!"
231257

258+
.PHONY: dist-texinfo
259+
dist-texinfo:
232260
# archive the texinfo build
233261
@echo "Building Texinfo..."
262+
mkdir -p dist
234263
rm -rf build/texinfo
264+
find dist -name 'python-$(DISTVERSION)-docs-texinfo*' -exec rm -rf {} \;
235265
$(MAKE) texinfo
236266
$(MAKE) info --directory=build/texinfo
237267
cp -pPR build/texinfo dist/python-$(DISTVERSION)-docs-texinfo

Doc/c-api/contextvars.rst

+46
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,52 @@ Context object management functions:
101101
current context for the current thread. Returns ``0`` on success,
102102
and ``-1`` on error.
103103
104+
.. c:function:: int PyContext_AddWatcher(PyContext_WatchCallback callback)
105+
106+
Register *callback* as a context object watcher for the current interpreter.
107+
Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`.
108+
In case of error (e.g. no more watcher IDs available),
109+
return ``-1`` and set an exception.
110+
111+
.. versionadded:: 3.14
112+
113+
.. c:function:: int PyContext_ClearWatcher(int watcher_id)
114+
115+
Clear watcher identified by *watcher_id* previously returned from
116+
:c:func:`PyContext_AddWatcher` for the current interpreter.
117+
Return ``0`` on success, or ``-1`` and set an exception on error
118+
(e.g. if the given *watcher_id* was never registered.)
119+
120+
.. versionadded:: 3.14
121+
122+
.. c:type:: PyContextEvent
123+
124+
Enumeration of possible context object watcher events:
125+
- ``Py_CONTEXT_EVENT_ENTER``
126+
- ``Py_CONTEXT_EVENT_EXIT``
127+
128+
.. versionadded:: 3.14
129+
130+
.. c:type:: int (*PyContext_WatchCallback)(PyContextEvent event, PyContext* ctx)
131+
132+
Type of a context object watcher callback function.
133+
If *event* is ``Py_CONTEXT_EVENT_ENTER``, then the callback is invoked
134+
after *ctx* has been set as the current context for the current thread.
135+
Otherwise, the callback is invoked before the deactivation of *ctx* as the current context
136+
and the restoration of the previous contex object for the current thread.
137+
138+
If the callback returns with an exception set, it must return ``-1``; this
139+
exception will be printed as an unraisable exception using
140+
:c:func:`PyErr_FormatUnraisable`. Otherwise it should return ``0``.
141+
142+
There may already be a pending exception set on entry to the callback. In
143+
this case, the callback should return ``0`` with the same exception still
144+
set. This means the callback may not call any other API that can set an
145+
exception unless it saves and clears the exception state first, and restores
146+
it before returning.
147+
148+
.. versionadded:: 3.14
149+
104150
105151
Context variable functions:
106152

Doc/c-api/exceptions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ Exception Classes
733733
This creates a class object derived from :exc:`Exception` (accessible in C as
734734
:c:data:`PyExc_Exception`).
735735
736-
The :attr:`!__module__` attribute of the new class is set to the first part (up
736+
The :attr:`~type.__module__` attribute of the new class is set to the first part (up
737737
to the last dot) of the *name* argument, and the class name is set to the last
738738
part (after the last dot). The *base* argument can be used to specify alternate
739739
base classes; it can either be only one class or a tuple of classes. The *dict*

Doc/c-api/long.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
570570
On failure, return -1 with an exception set. This function always succeeds
571571
if *obj* is a :c:type:`PyLongObject` or its subtype.
572572
573-
.. versionadded:: 3.14
573+
.. versionadded:: next
574574
575575
576576
.. c:function:: PyObject* PyLong_GetInfo(void)

Doc/c-api/object.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@ Object Protocol
367367
The result will be ``1`` when at least one of the checks returns ``1``,
368368
otherwise it will be ``0``.
369369
370-
If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to
370+
If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to
371371
determine the subclass status as described in :pep:`3119`. Otherwise,
372372
*derived* is a subclass of *cls* if it is a direct or indirect subclass,
373-
i.e. contained in ``cls.__mro__``.
373+
i.e. contained in :attr:`cls.__mro__ <type.__mro__>`.
374374
375375
Normally only class objects, i.e. instances of :class:`type` or a derived
376376
class, are considered classes. However, objects can override this by having
377-
a :attr:`~class.__bases__` attribute (which must be a tuple of base classes).
377+
a :attr:`~type.__bases__` attribute (which must be a tuple of base classes).
378378
379379
380380
.. c:function:: int PyObject_IsInstance(PyObject *inst, PyObject *cls)
@@ -386,15 +386,15 @@ Object Protocol
386386
The result will be ``1`` when at least one of the checks returns ``1``,
387387
otherwise it will be ``0``.
388388
389-
If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to
389+
If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to
390390
determine the subclass status as described in :pep:`3119`. Otherwise, *inst*
391391
is an instance of *cls* if its class is a subclass of *cls*.
392392
393393
An instance *inst* can override what is considered its class by having a
394-
:attr:`~instance.__class__` attribute.
394+
:attr:`~object.__class__` attribute.
395395
396396
An object *cls* can override if it is considered a class, and what its base
397-
classes are, by having a :attr:`~class.__bases__` attribute (which must be a tuple
397+
classes are, by having a :attr:`~type.__bases__` attribute (which must be a tuple
398398
of base classes).
399399
400400

0 commit comments

Comments
 (0)