Skip to content

Commit 34f5119

Browse files
committed
Merge in the main branch
2 parents ecd7ae7 + 7c22ab5 commit 34f5119

File tree

225 files changed

+4468
-2160
lines changed

Some content is hidden

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

225 files changed

+4468
-2160
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trigger: ['main', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7']
1+
trigger: ['main', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
22

33
jobs:
44
- job: Prebuild

.azure-pipelines/posix-deps-apt.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

.azure-pipelines/posix-steps.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.azure-pipelines/pr.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ jobs:
4848
--prefix=/opt/python-dev \
4949
--with-openssl="$(brew --prefix [email protected])"
5050
- name: Build CPython
51-
run: make -j8
51+
run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt
5252
- name: Display build info
5353
run: make pythoninfo
54+
- name: Check compiler warnings
55+
run: python3 Tools/build/check_warnings.py --compiler-output-file-path=compiler_output.txt --warning-ignore-file-path=Tools/build/.warningignore_macos --compiler-output-type=clang
5456
- name: Tests
5557
run: make test

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8181
run: make pythoninfo
8282
- name: Check compiler warnings
83-
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu
83+
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu --compiler-output-type=json
8484
- name: Remount sources writable for tests
8585
# some tests write to srcdir, lack of pyc files slows down testing
8686
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw

Doc/Makefile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# You can set these variables from the command line.
77
PYTHON = python3
88
VENVDIR = ./venv
9+
UV = uv
910
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
1011
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
1112
JOBS = auto
@@ -150,14 +151,10 @@ gettext: build
150151
htmlview: html
151152
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
152153

153-
.PHONY: ensure-sphinx-autobuild
154-
ensure-sphinx-autobuild: venv
155-
$(call ensure_package,sphinx-autobuild)
156-
157154
.PHONY: htmllive
158155
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
159156
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
160-
htmllive: ensure-sphinx-autobuild html
157+
htmllive: _ensure-sphinx-autobuild html
161158

162159
.PHONY: clean
163160
clean: clean-venv
@@ -174,15 +171,15 @@ venv:
174171
echo "To recreate it, remove it first with \`make clean-venv'."; \
175172
else \
176173
echo "Creating venv in $(VENVDIR)"; \
177-
if uv --version > /dev/null; then \
178-
uv venv $(VENVDIR); \
179-
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \
174+
if $(UV) --version >/dev/null 2>&1; then \
175+
$(UV) venv $(VENVDIR); \
176+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
180177
else \
181178
$(PYTHON) -m venv $(VENVDIR); \
182179
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
183180
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
184-
echo "The venv has been created in the $(VENVDIR) directory"; \
185181
fi; \
182+
echo "The venv has been created in the $(VENVDIR) directory"; \
186183
fi
187184

188185
.PHONY: dist
@@ -240,17 +237,24 @@ dist:
240237
rm -r dist/python-$(DISTVERSION)-docs-texinfo
241238
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
242239

243-
define ensure_package
244-
if uv --version > /dev/null; then \
245-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
240+
.PHONY: _ensure-package
241+
_ensure-package: venv
242+
if $(UV) --version >/dev/null 2>&1; then \
243+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
246244
else \
247-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
245+
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
248246
fi
249-
endef
247+
248+
.PHONY: _ensure-pre-commit
249+
_ensure-pre-commit:
250+
make _ensure-package PACKAGE=pre-commit
251+
252+
.PHONY: _ensure-sphinx-autobuild
253+
_ensure-sphinx-autobuild:
254+
make _ensure-package PACKAGE=sphinx-autobuild
250255

251256
.PHONY: check
252-
check: venv
253-
$(call ensure_package,pre_commit)
257+
check: _ensure-pre-commit
254258
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
255259

256260
.PHONY: serve

Doc/c-api/bytearray.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,22 @@ Direct API functions
4242
Return a new bytearray object from any object, *o*, that implements the
4343
:ref:`buffer protocol <bufferobjects>`.
4444
45+
On failure, return ``NULL`` with an exception set.
46+
4547
4648
.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
4749
48-
Create a new bytearray object from *string* and its length, *len*. On
49-
failure, ``NULL`` is returned.
50+
Create a new bytearray object from *string* and its length, *len*.
51+
52+
On failure, return ``NULL`` with an exception set.
5053
5154
5255
.. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
5356
5457
Concat bytearrays *a* and *b* and return a new bytearray with the result.
5558
59+
On failure, return ``NULL`` with an exception set.
60+
5661
5762
.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
5863

Doc/c-api/iter.rst

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ There are two functions specifically for working with iterators.
1010
.. c:function:: int PyIter_Check(PyObject *o)
1111
1212
Return non-zero if the object *o* can be safely passed to
13-
:c:func:`PyIter_Next`, and ``0`` otherwise. This function always succeeds.
13+
:c:func:`PyIter_NextItem` and ``0`` otherwise.
14+
This function always succeeds.
1415
1516
.. c:function:: int PyAIter_Check(PyObject *o)
1617
@@ -19,41 +20,27 @@ There are two functions specifically for working with iterators.
1920
2021
.. versionadded:: 3.10
2122
23+
.. c:function:: int PyIter_NextItem(PyObject *iter, PyObject **item)
24+
25+
Return ``1`` and set *item* to a :term:`strong reference` of the
26+
next value of the iterator *iter* on success.
27+
Return ``0`` and set *item* to ``NULL`` if there are no remaining values.
28+
Return ``-1``, set *item* to ``NULL`` and set an exception on error.
29+
30+
.. versionadded:: 3.14
31+
2232
.. c:function:: PyObject* PyIter_Next(PyObject *o)
2333
34+
This is an older version of :c:func:`!PyIter_NextItem`,
35+
which is retained for backwards compatibility.
36+
Prefer :c:func:`PyIter_NextItem`.
37+
2438
Return the next value from the iterator *o*. The object must be an iterator
2539
according to :c:func:`PyIter_Check` (it is up to the caller to check this).
2640
If there are no remaining values, returns ``NULL`` with no exception set.
2741
If an error occurs while retrieving the item, returns ``NULL`` and passes
2842
along the exception.
2943
30-
To write a loop which iterates over an iterator, the C code should look
31-
something like this::
32-
33-
PyObject *iterator = PyObject_GetIter(obj);
34-
PyObject *item;
35-
36-
if (iterator == NULL) {
37-
/* propagate error */
38-
}
39-
40-
while ((item = PyIter_Next(iterator))) {
41-
/* do something with item */
42-
...
43-
/* release reference when done */
44-
Py_DECREF(item);
45-
}
46-
47-
Py_DECREF(iterator);
48-
49-
if (PyErr_Occurred()) {
50-
/* propagate error */
51-
}
52-
else {
53-
/* continue doing useful work */
54-
}
55-
56-
5744
.. c:type:: PySendResult
5845
5946
The enum value used to represent different results of :c:func:`PyIter_Send`.

Doc/constraints.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
# Direct dependencies of Sphinx
88
babel<3
99
colorama<0.5
10-
imagesize<1.5
11-
Jinja2<3.2
10+
imagesize<2
11+
Jinja2<4
1212
packaging<25
1313
Pygments<3
1414
requests<3
1515
snowballstemmer<3
16-
sphinxcontrib-applehelp<2.1
17-
sphinxcontrib-devhelp<2.1
18-
sphinxcontrib-htmlhelp<2.2
19-
sphinxcontrib-jsmath<1.1
20-
sphinxcontrib-qthelp<2.1
21-
sphinxcontrib-serializinghtml<2.1
16+
# keep lower-bounds until Sphinx 8.1 is released
17+
# https://github.com/sphinx-doc/sphinx/pull/12756
18+
sphinxcontrib-applehelp>=1.0.7,<3
19+
sphinxcontrib-devhelp>=1.0.6,<3
20+
sphinxcontrib-htmlhelp>=2.0.6,<3
21+
sphinxcontrib-jsmath>=1.0.1,<2
22+
sphinxcontrib-qthelp>=1.0.6,<3
23+
sphinxcontrib-serializinghtml>=1.1.9,<3
2224

2325
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
24-
MarkupSafe<2.2
26+
MarkupSafe<3

Doc/data/refcounts.dat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,10 @@ PyAIter_Check:PyObject*:o:0:
11321132
PyIter_Next:PyObject*::+1:
11331133
PyIter_Next:PyObject*:o:0:
11341134

1135+
PyIter_NextItem:int:::
1136+
PyIter_NextItem:PyObject*:iter:0:
1137+
PyIter_NextItem:PyObject**:item:+1:
1138+
11351139
PyIter_Send:int:::
11361140
PyIter_Send:PyObject*:iter:0:
11371141
PyIter_Send:PyObject*:arg:0:

Doc/data/stable_abi.dat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ although there is currently no date scheduled for their removal.
6767
* ``EntryPoints`` tuple interface.
6868
* Implicit ``None`` on return values.
6969

70+
* :mod:`logging`: the ``warn()`` method has been deprecated
71+
since Python 3.3, use :meth:`~logging.warning()` instead.
72+
7073
* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
7174
BytesIO and binary mode instead.
7275

Doc/library/dis.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,11 +1081,15 @@ iterations of the loop.
10811081
.. opcode:: BUILD_TUPLE (count)
10821082

10831083
Creates a tuple consuming *count* items from the stack, and pushes the
1084-
resulting tuple onto the stack.::
1084+
resulting tuple onto the stack::
10851085

1086-
assert count > 0
1087-
STACK, values = STACK[:-count], STACK[-count:]
1088-
STACK.append(tuple(values))
1086+
if count == 0:
1087+
value = ()
1088+
else:
1089+
STACK = STACK[:-count]
1090+
value = tuple(STACK[-count:])
1091+
1092+
STACK.append(value)
10891093

10901094

10911095
.. opcode:: BUILD_LIST (count)

Doc/library/inspect.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,19 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
153153
| | f_trace | tracing function for this |
154154
| | | frame, or ``None`` |
155155
+-----------------+-------------------+---------------------------+
156+
| | f_trace_lines | indicate whether a |
157+
| | | tracing event is |
158+
| | | triggered for each source |
159+
| | | source line |
160+
+-----------------+-------------------+---------------------------+
161+
| | f_trace_opcodes | indicate whether |
162+
| | | per-opcode events are |
163+
| | | requested |
164+
+-----------------+-------------------+---------------------------+
165+
| | clear() | used to clear all |
166+
| | | references to local |
167+
| | | variables |
168+
+-----------------+-------------------+---------------------------+
156169
| code | co_argcount | number of arguments (not |
157170
| | | including keyword only |
158171
| | | arguments, \* or \*\* |
@@ -214,6 +227,18 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
214227
| | | arguments and local |
215228
| | | variables |
216229
+-----------------+-------------------+---------------------------+
230+
| | co_lines() | returns an iterator that |
231+
| | | yields successive |
232+
| | | bytecode ranges |
233+
+-----------------+-------------------+---------------------------+
234+
| | co_positions() | returns an iterator of |
235+
| | | source code positions for |
236+
| | | each bytecode instruction |
237+
+-----------------+-------------------+---------------------------+
238+
| | replace() | returns a copy of the |
239+
| | | code object with new |
240+
| | | values |
241+
+-----------------+-------------------+---------------------------+
217242
| generator | __name__ | name |
218243
+-----------------+-------------------+---------------------------+
219244
| | __qualname__ | qualified name |

0 commit comments

Comments
 (0)