Skip to content

Commit

Permalink
Merge branch 'main' into imaginary-class-109218
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev authored Aug 14, 2024
2 parents d605b8e + e03073f commit f3310d2
Show file tree
Hide file tree
Showing 331 changed files with 17,341 additions and 8,264 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
trigger: ['main', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7']
trigger: ['main', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']

jobs:
- job: Prebuild
Expand Down
27 changes: 0 additions & 27 deletions .azure-pipelines/posix-deps-apt.sh

This file was deleted.

26 changes: 0 additions & 26 deletions .azure-pipelines/posix-steps.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .azure-pipelines/pr.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM docker.io/library/fedora:40

ENV CC=clang

ENV WASI_SDK_VERSION=22
ENV WASI_SDK_VERSION=24
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
Expand All @@ -14,7 +14,7 @@ RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,cla
dnf -y clean all

RUN mkdir ${WASI_SDK_PATH} && \
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz | \
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip

RUN mkdir --parents ${WASMTIME_HOME} && \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/reusable-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ jobs:
--prefix=/opt/python-dev \
--with-openssl="$(brew --prefix [email protected])"
- name: Build CPython
run: make -j8
run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt
- name: Display build info
run: make pythoninfo
- name: Check compiler warnings
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
- name: Tests
run: make test
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make pythoninfo
- name: Check compiler warnings
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
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
- name: Remount sources writable for tests
# some tests write to srcdir, lack of pyc files slows down testing
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
env:
WASMTIME_VERSION: 22.0.0
WASI_SDK_VERSION: 22
WASI_SDK_VERSION: 24
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_PYTHON: cross-build/build
CROSS_BUILD_WASI: cross-build/wasm32-wasi
Expand All @@ -33,7 +33,7 @@ jobs:
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.WASI_SDK_PATH }} && \
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz | \
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-x86_64-linux.tar.gz | \
tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
- name: "Configure ccache action"
uses: hendrikmuhs/[email protected]
Expand Down
36 changes: 20 additions & 16 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# You can set these variables from the command line.
PYTHON = python3
VENVDIR = ./venv
UV = uv
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
JOBS = auto
Expand Down Expand Up @@ -150,14 +151,10 @@ gettext: build
htmlview: html
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"

.PHONY: ensure-sphinx-autobuild
ensure-sphinx-autobuild: venv
$(call ensure_package,sphinx-autobuild)

.PHONY: htmllive
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
htmllive: ensure-sphinx-autobuild html
htmllive: _ensure-sphinx-autobuild html

.PHONY: clean
clean: clean-venv
Expand All @@ -174,15 +171,15 @@ venv:
echo "To recreate it, remove it first with \`make clean-venv'."; \
else \
echo "Creating venv in $(VENVDIR)"; \
if uv --version > /dev/null; then \
uv venv $(VENVDIR); \
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \
if $(UV) --version >/dev/null 2>&1; then \
$(UV) venv $(VENVDIR); \
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
else \
$(PYTHON) -m venv $(VENVDIR); \
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi; \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi

.PHONY: dist
Expand Down Expand Up @@ -240,17 +237,24 @@ dist:
rm -r dist/python-$(DISTVERSION)-docs-texinfo
rm dist/python-$(DISTVERSION)-docs-texinfo.tar

define ensure_package
if uv --version > /dev/null; then \
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
.PHONY: _ensure-package
_ensure-package: venv
if $(UV) --version >/dev/null 2>&1; then \
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
else \
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
fi
endef

.PHONY: _ensure-pre-commit
_ensure-pre-commit:
make _ensure-package PACKAGE=pre-commit

.PHONY: _ensure-sphinx-autobuild
_ensure-sphinx-autobuild:
make _ensure-package PACKAGE=sphinx-autobuild

.PHONY: check
check: venv
$(call ensure_package,pre_commit)
check: _ensure-pre-commit
$(VENVDIR)/bin/python3 -m pre_commit run --all-files

.PHONY: serve
Expand Down
9 changes: 7 additions & 2 deletions Doc/c-api/bytearray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,22 @@ Direct API functions
Return a new bytearray object from any object, *o*, that implements the
:ref:`buffer protocol <bufferobjects>`.
On failure, return ``NULL`` with an exception set.
.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
Create a new bytearray object from *string* and its length, *len*. On
failure, ``NULL`` is returned.
Create a new bytearray object from *string* and its length, *len*.
On failure, return ``NULL`` with an exception set.
.. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
Concat bytearrays *a* and *b* and return a new bytearray with the result.
On failure, return ``NULL`` with an exception set.
.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
Expand Down
43 changes: 15 additions & 28 deletions Doc/c-api/iter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ There are two functions specifically for working with iterators.
.. c:function:: int PyIter_Check(PyObject *o)
Return non-zero if the object *o* can be safely passed to
:c:func:`PyIter_Next`, and ``0`` otherwise. This function always succeeds.
:c:func:`PyIter_NextItem` and ``0`` otherwise.
This function always succeeds.
.. c:function:: int PyAIter_Check(PyObject *o)
Expand All @@ -19,41 +20,27 @@ There are two functions specifically for working with iterators.
.. versionadded:: 3.10
.. c:function:: int PyIter_NextItem(PyObject *iter, PyObject **item)
Return ``1`` and set *item* to a :term:`strong reference` of the
next value of the iterator *iter* on success.
Return ``0`` and set *item* to ``NULL`` if there are no remaining values.
Return ``-1``, set *item* to ``NULL`` and set an exception on error.
.. versionadded:: 3.14
.. c:function:: PyObject* PyIter_Next(PyObject *o)
This is an older version of :c:func:`!PyIter_NextItem`,
which is retained for backwards compatibility.
Prefer :c:func:`PyIter_NextItem`.
Return the next value from the iterator *o*. The object must be an iterator
according to :c:func:`PyIter_Check` (it is up to the caller to check this).
If there are no remaining values, returns ``NULL`` with no exception set.
If an error occurs while retrieving the item, returns ``NULL`` and passes
along the exception.
To write a loop which iterates over an iterator, the C code should look
something like this::
PyObject *iterator = PyObject_GetIter(obj);
PyObject *item;
if (iterator == NULL) {
/* propagate error */
}
while ((item = PyIter_Next(iterator))) {
/* do something with item */
...
/* release reference when done */
Py_DECREF(item);
}
Py_DECREF(iterator);
if (PyErr_Occurred()) {
/* propagate error */
}
else {
/* continue doing useful work */
}
.. c:type:: PySendResult
The enum value used to represent different results of :c:func:`PyIter_Send`.
Expand Down
11 changes: 11 additions & 0 deletions Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,17 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
.. versionadded:: 3.14
.. c:function:: PyObject* PyLong_GetInfo(void)
On success, return a read only :term:`named tuple`, that holds
information about Python's internal representation of integers.
See :data:`sys.int_info` for description of individual fields.
On failure, return ``NULL`` with an exception set.
.. versionadded:: 3.1
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
Return 1 if *op* is compact, 0 otherwise.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ The available slot types are:
This slot is ignored by Python builds not configured with
:option:`--disable-gil`. Otherwise, it determines whether or not importing
this module will cause the GIL to be automatically enabled. See
:ref:`free-threaded-cpython` for more detail.
:ref:`whatsnew313-free-threaded-cpython` for more detail.
Multiple ``Py_mod_gil`` slots may not be specified in one module definition.
Expand Down
20 changes: 11 additions & 9 deletions Doc/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
# Direct dependencies of Sphinx
babel<3
colorama<0.5
imagesize<1.5
Jinja2<3.2
imagesize<2
Jinja2<4
packaging<25
Pygments<3
requests<3
snowballstemmer<3
sphinxcontrib-applehelp<2.1
sphinxcontrib-devhelp<2.1
sphinxcontrib-htmlhelp<2.2
sphinxcontrib-jsmath<1.1
sphinxcontrib-qthelp<2.1
sphinxcontrib-serializinghtml<2.1
# keep lower-bounds until Sphinx 8.1 is released
# https://github.com/sphinx-doc/sphinx/pull/12756
sphinxcontrib-applehelp>=1.0.7,<3
sphinxcontrib-devhelp>=1.0.6,<3
sphinxcontrib-htmlhelp>=2.0.6,<3
sphinxcontrib-jsmath>=1.0.1,<2
sphinxcontrib-qthelp>=1.0.6,<3
sphinxcontrib-serializinghtml>=1.1.9,<3

# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
MarkupSafe<2.2
MarkupSafe<3
4 changes: 4 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ PyAIter_Check:PyObject*:o:0:
PyIter_Next:PyObject*::+1:
PyIter_Next:PyObject*:o:0:

PyIter_NextItem:int:::
PyIter_NextItem:PyObject*:iter:0:
PyIter_NextItem:PyObject**:item:+1:

PyIter_Send:int:::
PyIter_Send:PyObject*:iter:0:
PyIter_Send:PyObject*:arg:0:
Expand Down
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ although there is currently no date scheduled for their removal.
* ``EntryPoints`` tuple interface.
* Implicit ``None`` on return values.

* :mod:`logging`: the ``warn()`` method has been deprecated
since Python 3.3, use :meth:`~logging.warning()` instead.

* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
BytesIO and binary mode instead.

Expand Down
Loading

0 comments on commit f3310d2

Please sign in to comment.