Skip to content

Commit 2e3f404

Browse files
authored
Merge branch '3.13' into backport-3880917-3.13
2 parents 5e01c39 + 8af2d18 commit 2e3f404

Some content is hidden

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

79 files changed

+1577
-961
lines changed

Android/README.md

Lines changed: 12 additions & 11 deletions
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
@@ -87,10 +83,10 @@ and copy it over.
8783
The test suite can usually be run on a device with 2 GB of RAM, though for some
8884
configurations or test orders you may need to increase this. As of Android
8985
Studio Koala, 2 GB is the default for all emulators, although the user interface
90-
may indicate otherwise. The effective setting is `hw.ramSize` in
91-
~/.android/avd/*.avd/hardware-qemu.ini, whereas Android Studio displays the
92-
value from config.ini. Changing the value in Android Studio will update both of
93-
these files.
86+
may indicate otherwise. Locate the emulator's directory under `~/.android/avd`,
87+
and find `hw.ramSize` in both config.ini and hardware-qemu.ini. Either set these
88+
manually to the same value, or use the Android Studio Device Manager, which will
89+
update both files.
9490

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

Doc/Makefile

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ pydoc-topics: build
144144

145145
.PHONY: gettext
146146
gettext: BUILDER = gettext
147-
gettext: SPHINXOPTS += '-d build/doctrees-gettext'
147+
gettext: SPHINXOPTS += -d build/doctrees-gettext
148148
gettext: build
149149

150150
.PHONY: htmlview
151151
htmlview: html
152152
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
153153

154154
.PHONY: htmllive
155-
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
155+
htmllive: SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-autobuild
156156
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
157157
htmllive: _ensure-sphinx-autobuild html
158158

@@ -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,26 +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

225-
# archive the letter latex
226-
@echo "Building LaTeX (US paper)..."
227-
rm -rf build/latex
228-
$(MAKE) latex PAPER=letter
229-
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
230-
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
231-
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
232-
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
233-
@echo "Build finished and archived!"
234-
247+
.PHONY: dist-epub
248+
dist-epub:
235249
# copy the epub build
236250
@echo "Building EPUB..."
251+
mkdir -p dist
237252
rm -rf build/epub
253+
rm -f dist/python-$(DISTVERSION)-docs.epub
238254
$(MAKE) epub
239255
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
240256
@echo "Build finished and archived!"
241257

258+
.PHONY: dist-texinfo
259+
dist-texinfo:
242260
# archive the texinfo build
243261
@echo "Building Texinfo..."
262+
mkdir -p dist
244263
rm -rf build/texinfo
264+
find dist -name 'python-$(DISTVERSION)-docs-texinfo*' -exec rm -rf {} \;
245265
$(MAKE) texinfo
246266
$(MAKE) info --directory=build/texinfo
247267
cp -pPR build/texinfo dist/python-$(DISTVERSION)-docs-texinfo

Doc/c-api/code.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ bound into a function.
9696
Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it.
9797
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
9898
99-
For efficiently iterating over the line numbers in a code object, use `the API described in PEP 626
100-
<https://peps.python.org/pep-0626/#out-of-process-debuggers-and-profilers>`_.
99+
For efficiently iterating over the line numbers in a code object, use :pep:`the API described in PEP 626
100+
<0626#out-of-process-debuggers-and-profilers>`.
101101
102102
.. c:function:: int PyCode_Addr2Location(PyObject *co, int byte_offset, int *start_line, int *start_column, int *end_line, int *end_column)
103103

Doc/c-api/exceptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ the variables:
10041004
single: PyExc_OverflowError (C var)
10051005
single: PyExc_PermissionError (C var)
10061006
single: PyExc_ProcessLookupError (C var)
1007+
single: PyExc_PythonFinalizationError (C var)
10071008
single: PyExc_RecursionError (C var)
10081009
single: PyExc_ReferenceError (C var)
10091010
single: PyExc_RuntimeError (C var)
@@ -1096,6 +1097,8 @@ the variables:
10961097
+-----------------------------------------+---------------------------------+----------+
10971098
| :c:data:`PyExc_ProcessLookupError` | :exc:`ProcessLookupError` | |
10981099
+-----------------------------------------+---------------------------------+----------+
1100+
| :c:data:`PyExc_PythonFinalizationError` | :exc:`PythonFinalizationError` | |
1101+
+-----------------------------------------+---------------------------------+----------+
10991102
| :c:data:`PyExc_RecursionError` | :exc:`RecursionError` | |
11001103
+-----------------------------------------+---------------------------------+----------+
11011104
| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | |

Doc/c-api/long.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
452452
Currently, ``-1`` corresponds to
453453
``Py_ASNATIVEBYTES_NATIVE_ENDIAN | Py_ASNATIVEBYTES_UNSIGNED_BUFFER``.
454454
455+
.. c:namespace:: NULL
456+
455457
============================================= ======
456458
Flag Value
457459
============================================= ======

Doc/c-api/module.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ The available slot types are:
421421
422422
Specifies one of the following values:
423423
424+
.. c:namespace:: NULL
425+
424426
.. c:macro:: Py_MOD_GIL_USED
425427
426428
The module depends on the presence of the global interpreter lock (GIL),

Doc/c-api/monitoring.rst

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. highlight:: c
22

3-
.. _monitoring:
3+
.. _c-api-monitoring:
44

55
Monitoring C API
66
================
@@ -133,32 +133,60 @@ Managing the Monitoring State
133133
Monitoring states can be managed with the help of monitoring scopes. A scope
134134
would typically correspond to a python function.
135135
136-
.. :c:function:: int PyMonitoring_EnterScope(PyMonitoringState *state_array, uint64_t *version, const uint8_t *event_types, Py_ssize_t length)
136+
.. c:function:: int PyMonitoring_EnterScope(PyMonitoringState *state_array, uint64_t *version, const uint8_t *event_types, Py_ssize_t length)
137137
138138
Enter a monitored scope. ``event_types`` is an array of the event IDs for
139139
events that may be fired from the scope. For example, the ID of a ``PY_START``
140140
event is the value ``PY_MONITORING_EVENT_PY_START``, which is numerically equal
141141
to the base-2 logarithm of ``sys.monitoring.events.PY_START``.
142142
``state_array`` is an array with a monitoring state entry for each event in
143143
``event_types``, it is allocated by the user but populated by
144-
``PyMonitoring_EnterScope`` with information about the activation state of
144+
:c:func:`!PyMonitoring_EnterScope` with information about the activation state of
145145
the event. The size of ``event_types`` (and hence also of ``state_array``)
146146
is given in ``length``.
147147
148148
The ``version`` argument is a pointer to a value which should be allocated
149149
by the user together with ``state_array`` and initialized to 0,
150-
and then set only by ``PyMonitoring_EnterScope`` itelf. It allows this
150+
and then set only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this
151151
function to determine whether event states have changed since the previous call,
152152
and to return quickly if they have not.
153153
154154
The scopes referred to here are lexical scopes: a function, class or method.
155-
``PyMonitoring_EnterScope`` should be called whenever the lexical scope is
155+
:c:func:`!PyMonitoring_EnterScope` should be called whenever the lexical scope is
156156
entered. Scopes can be reentered, reusing the same *state_array* and *version*,
157157
in situations like when emulating a recursive Python function. When a code-like's
158158
execution is paused, such as when emulating a generator, the scope needs to
159159
be exited and re-entered.
160160
161-
162-
.. :c:function:: int PyMonitoring_ExitScope(void)
163-
164-
Exit the last scope that was entered with ``PyMonitoring_EnterScope``.
161+
The macros for *event_types* are:
162+
163+
.. c:namespace:: NULL
164+
165+
.. The table is here to make the docs searchable, and to allow automatic
166+
links to the identifiers.
167+
168+
================================================== =====================================
169+
Macro Event
170+
================================================== =====================================
171+
.. c:macro:: PY_MONITORING_EVENT_BRANCH :monitoring-event:`BRANCH`
172+
.. c:macro:: PY_MONITORING_EVENT_CALL :monitoring-event:`CALL`
173+
.. c:macro:: PY_MONITORING_EVENT_C_RAISE :monitoring-event:`C_RAISE`
174+
.. c:macro:: PY_MONITORING_EVENT_C_RETURN :monitoring-event:`C_RETURN`
175+
.. c:macro:: PY_MONITORING_EVENT_EXCEPTION_HANDLED :monitoring-event:`EXCEPTION_HANDLED`
176+
.. c:macro:: PY_MONITORING_EVENT_INSTRUCTION :monitoring-event:`INSTRUCTION`
177+
.. c:macro:: PY_MONITORING_EVENT_JUMP :monitoring-event:`JUMP`
178+
.. c:macro:: PY_MONITORING_EVENT_LINE :monitoring-event:`LINE`
179+
.. c:macro:: PY_MONITORING_EVENT_PY_RESUME :monitoring-event:`PY_RESUME`
180+
.. c:macro:: PY_MONITORING_EVENT_PY_RETURN :monitoring-event:`PY_RETURN`
181+
.. c:macro:: PY_MONITORING_EVENT_PY_START :monitoring-event:`PY_START`
182+
.. c:macro:: PY_MONITORING_EVENT_PY_THROW :monitoring-event:`PY_THROW`
183+
.. c:macro:: PY_MONITORING_EVENT_PY_UNWIND :monitoring-event:`PY_UNWIND`
184+
.. c:macro:: PY_MONITORING_EVENT_PY_YIELD :monitoring-event:`PY_YIELD`
185+
.. c:macro:: PY_MONITORING_EVENT_RAISE :monitoring-event:`RAISE`
186+
.. c:macro:: PY_MONITORING_EVENT_RERAISE :monitoring-event:`RERAISE`
187+
.. c:macro:: PY_MONITORING_EVENT_STOP_ITERATION :monitoring-event:`STOP_ITERATION`
188+
================================================== =====================================
189+
190+
.. c:function:: int PyMonitoring_ExitScope(void)
191+
192+
Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`.

Doc/c-api/refcounting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ of Python objects.
6262
``NULL``, use :c:func:`Py_XINCREF`.
6363
6464
Do not expect this function to actually modify *o* in any way.
65-
For at least `some objects <https://peps.python.org/pep-0683/>`_,
65+
For at least :pep:`some objects <0683>`,
6666
this function has no effect.
6767
6868
.. versionchanged:: 3.12
@@ -130,7 +130,7 @@ of Python objects.
130130
use :c:func:`Py_XDECREF`.
131131
132132
Do not expect this function to actually modify *o* in any way.
133-
For at least `some objects <https://peps.python.org/pep-0683/>`_,
133+
For at least :pep:`some objects <683>`,
134134
this function has no effect.
135135
136136
.. warning::

Doc/c-api/time.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.. highlight:: c
22

3+
.. _c-api-time:
4+
35
PyTime C API
46
============
57

Doc/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
('c:func', 'vsnprintf'),
133133
# Standard C types
134134
('c:type', 'FILE'),
135+
('c:type', 'int8_t'),
136+
('c:type', 'int16_t'),
135137
('c:type', 'int32_t'),
136138
('c:type', 'int64_t'),
137139
('c:type', 'intmax_t'),
@@ -141,6 +143,9 @@
141143
('c:type', 'size_t'),
142144
('c:type', 'ssize_t'),
143145
('c:type', 'time_t'),
146+
('c:type', 'uint8_t'),
147+
('c:type', 'uint16_t'),
148+
('c:type', 'uint32_t'),
144149
('c:type', 'uint64_t'),
145150
('c:type', 'uintmax_t'),
146151
('c:type', 'uintptr_t'),
@@ -243,6 +248,7 @@
243248
('c:data', 'PyExc_OverflowError'),
244249
('c:data', 'PyExc_PermissionError'),
245250
('c:data', 'PyExc_ProcessLookupError'),
251+
('c:data', 'PyExc_PythonFinalizationError'),
246252
('c:data', 'PyExc_RecursionError'),
247253
('c:data', 'PyExc_ReferenceError'),
248254
('c:data', 'PyExc_RuntimeError'),
@@ -547,6 +553,8 @@
547553
r'https://msdn.microsoft.com/.*': 'https://learn.microsoft.com/.*',
548554
r'https://docs.microsoft.com/.*': 'https://learn.microsoft.com/.*',
549555
r'https://go.microsoft.com/fwlink/\?LinkID=\d+': 'https://learn.microsoft.com/.*',
556+
# Debian's man page redirects to its current stable version
557+
r'https://manpages.debian.org/\w+\(\d(\w+)?\)': r'https://manpages.debian.org/\w+/[\w/\-\.]*\.\d(\w+)?\.en\.html',
550558
# Language redirects
551559
r'https://toml.io': 'https://toml.io/en/',
552560
r'https://www.redhat.com': 'https://www.redhat.com/en',

0 commit comments

Comments
 (0)