Skip to content

Commit

Permalink
Merge branch 'main' into argparse-filetype-deprecate
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka authored Oct 21, 2024
2 parents 8e8e2ec + 44f841f commit 9e3b098
Show file tree
Hide file tree
Showing 948 changed files with 17,004 additions and 5,434 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,5 @@ Lib/test/test_configparser.py @jaraco

# Doc sections
Doc/reference/ @willingc

**/*weakref* @kumaraditya303
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ body:
label: "CPython versions tested on:"
multiple: true
options:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "CPython main branch"
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/crash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ body:
label: "CPython versions tested on:"
multiple: true
options:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "CPython main branch"
validations:
required: true
Expand Down
55 changes: 46 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,50 @@ jobs:
if: fromJSON(needs.check_source.outputs.run-docs)
uses: ./.github/workflows/reusable-docs.yml

check_autoconf_regen:
name: 'Check if Autoconf files are up to date'
# Don't use ubuntu-latest but a specific version to make the job
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
runs-on: ubuntu-24.04
container:
image: ghcr.io/python/autoconf:2024.10.11.11293396815
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
steps:
- name: Install Git
run: |
apt install git -yq
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Runner image version
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
- name: Check Autoconf and aclocal versions
run: |
grep "Generated by GNU Autoconf 2.71" configure
grep "aclocal 1.16.5" aclocal.m4
grep -q "runstatedir" configure
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
- name: Regenerate autoconf files
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
run: autoreconf -ivf -Werror
- name: Check for changes
run: |
git add -u
changes=$(git status --porcelain)
# Check for changes in regenerated files
if test -n "$changes"; then
echo "Generated files not up to date."
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
echo "configure files must be regenerated with a specific version of autoconf."
echo "$changes"
echo ""
git diff --staged || true
exit 1
fi
check_generated_files:
name: 'Check if generated files are up to date'
# Don't use ubuntu-latest but a specific version to make the job
Expand Down Expand Up @@ -69,19 +113,10 @@ jobs:
uses: hendrikmuhs/ccache-action@v1.2
with:
save: false
- name: Check Autoconf and aclocal versions
run: |
grep "Generated by GNU Autoconf 2.71" configure
grep "aclocal 1.16.5" aclocal.m4
grep -q "runstatedir" configure
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
- name: Configure CPython
run: |
# Build Python with the libpython dynamic library
./configure --config-cache --with-pydebug --enable-shared
- name: Regenerate autoconf files
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
run: autoreconf -ivf -Werror
- name: Build CPython
run: |
make -j4 regen-all
Expand Down Expand Up @@ -501,6 +536,7 @@ jobs:
needs:
- check_source # Transitive dependency, needed to access `run_tests` value
- check-docs
- check_autoconf_regen
- check_generated_files
- build_macos
- build_ubuntu
Expand Down Expand Up @@ -536,6 +572,7 @@ jobs:
${{
needs.check_source.outputs.run_tests != 'true'
&& '
check_autoconf_regen,
check_generated_files,
build_macos,
build_ubuntu,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"
cache: pip
cache-dependency-path: Tools/requirements-dev.txt
- run: pip install -r Tools/requirements-dev.txt
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/posix-deps-apt.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh
apt-get update

# autoconf-archive is needed by autoreconf (check_generated_files job)
apt-get -yq install \
build-essential \
pkg-config \
autoconf-archive \
ccache \
gdb \
lcov \
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/reusable-change-detection.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---

name: Change detection
name: Reusable change detection

on: # yamllint disable-line rule:truthy
workflow_call:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docs
name: Reusable Docs

on:
workflow_call:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.12' # known to work with Sphinx 6.2.1
python-version: '3.13' # known to work with Sphinx 7.2.6
cache: 'pip'
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
- name: 'Install build dependencies'
Expand All @@ -95,7 +95,7 @@ jobs:
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
doctest:
name: 'Doctest'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/reusable-macos.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Reusable macOS

on:
workflow_call:
inputs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/reusable-tsan.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Reusable Thread Sanitizer

on:
workflow_call:
inputs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Reusable Ubuntu

on:
workflow_call:
inputs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Reusable WASI

on:
workflow_call:
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-windows-msi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TestsMSI
name: Reusable Windows MSI

on:
workflow_call:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/reusable-windows.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Reusable Windows

on:
workflow_call:
inputs:
Expand Down
16 changes: 5 additions & 11 deletions Doc/c-api/contextvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,14 @@ Context object management functions:
Enumeration of possible context object watcher events:
- ``Py_CONTEXT_EVENT_ENTER``: A context has been entered, causing the
:term:`current context` to switch to it. The object passed to the watch
callback is the now-current :class:`contextvars.Context` object. Each
enter event will eventually have a corresponding exit event for the same
context object after any subsequently entered contexts have themselves been
exited.
- ``Py_CONTEXT_EVENT_EXIT``: A context is about to be exited, which will
cause the :term:`current context` to switch back to what it was before the
context was entered. The object passed to the watch callback is the
still-current :class:`contextvars.Context` object.
- ``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a
different context. The object passed to the watch callback is the
now-current :class:`contextvars.Context` object, or None if no context is
current.
.. versionadded:: 3.14
.. c:type:: int (*PyContext_WatchCallback)(PyContextEvent event, PyContext* ctx)
.. c:type:: int (*PyContext_WatchCallback)(PyContextEvent event, PyObject *obj)
Context object watcher callback function. The object passed to the callback
is event-specific; see :c:type:`PyContextEvent` for details.
Expand Down
19 changes: 11 additions & 8 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ Process-wide parameters
returned string points into static storage; the caller should not modify its
value. This corresponds to the :makevar:`prefix` variable in the top-level
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
script at build time. The value is available to Python code as ``sys.prefix``.
script at build time. The value is available to Python code as ``sys.base_prefix``.
It is only useful on Unix. See also the next function.
This function should not be called before :c:func:`Py_Initialize`, otherwise
Expand All @@ -635,7 +635,8 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
Get :data:`sys.prefix` instead.
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
:ref:`virtual environments <venv-def>` need to be handled.
.. c:function:: wchar_t* Py_GetExecPrefix()
Expand All @@ -648,7 +649,8 @@ Process-wide parameters
should not modify its value. This corresponds to the :makevar:`exec_prefix`
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
argument to the :program:`configure` script at build time. The value is
available to Python code as ``sys.exec_prefix``. It is only useful on Unix.
available to Python code as ``sys.base_exec_prefix``. It is only useful on
Unix.
Background: The exec-prefix differs from the prefix when platform dependent
files (such as executables and shared libraries) are installed in a different
Expand Down Expand Up @@ -679,7 +681,8 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
Get :data:`sys.exec_prefix` instead.
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
:ref:`virtual environments <venv-def>` need to be handled.
.. c:function:: wchar_t* Py_GetProgramFullPath()
Expand Down Expand Up @@ -1195,7 +1198,7 @@ code, or when embedding the Python interpreter:
created by Python. Refer to
:ref:`cautions-regarding-runtime-finalization` for more details.
.. versionchanged:: next
.. versionchanged:: 3.14
Hangs the current thread, rather than terminating it, if called while the
interpreter is finalizing.
Expand Down Expand Up @@ -1257,7 +1260,7 @@ with sub-interpreters:
created by Python. Refer to
:ref:`cautions-regarding-runtime-finalization` for more details.
.. versionchanged:: next
.. versionchanged:: 3.14
Hangs the current thread, rather than terminating it, if called while the
interpreter is finalizing.
Expand Down Expand Up @@ -1547,7 +1550,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
:c:func:`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`,
and terminate the current thread if called while the interpreter is finalizing.
.. versionchanged:: next
.. versionchanged:: 3.14
Hangs the current thread, rather than terminating it, if called while the
interpreter is finalizing.
Expand Down Expand Up @@ -2418,7 +2421,7 @@ Example usage::
In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which
can call arbitrary code through an object's deallocation function. The critical
section API avoids potentital deadlocks due to reentrancy and lock ordering
section API avoids potential deadlocks due to reentrancy and lock ordering
by allowing the runtime to temporarily suspend the critical section if the
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
Expand Down
18 changes: 12 additions & 6 deletions Doc/c-api/init_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,8 @@ Create Config
Free memory of the initialization configuration *config*.
If *config* is ``NULL``, no operation is performed.
Error Handling
--------------
Expand Down Expand Up @@ -1823,14 +1825,18 @@ return ``-1`` on error:
PyInitConfig_Free(config);
return 0;
// Display the error message
const char *err_msg;
error:
(void)PyInitConfig_GetError(config, &err_msg);
printf("PYTHON INIT ERROR: %s\n", err_msg);
PyInitConfig_Free(config);
{
// Display the error message
// This uncommon braces style is used, because you cannot make
// goto targets point to variable declarations.
const char *err_msg;
(void)PyInitConfig_GetError(config, &err_msg);
printf("PYTHON INIT ERROR: %s\n", err_msg);
PyInitConfig_Free(config);
return -1;
return -1;
}
}
Expand Down
9 changes: 7 additions & 2 deletions Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
free(bignum);
*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults
that behave most like a C cast, or a combintation of the other flags in
that behave most like a C cast, or a combination of the other flags in
the table below.
Note that ``-1`` cannot be combined with other flags.
Expand Down Expand Up @@ -579,7 +579,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
On failure, return -1 with an exception set. This function always succeeds
if *obj* is a :c:type:`PyLongObject` or its subtype.
.. versionadded:: next
.. versionadded:: 3.14
.. c:function:: PyObject* PyLong_GetInfo(void)
Expand Down Expand Up @@ -608,10 +608,15 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
Exactly what values are considered compact is an implementation detail
and is subject to change.
.. versionadded:: 3.12
.. c:function:: Py_ssize_t PyUnstable_Long_CompactValue(const PyLongObject* op)
If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`,
return its value.
Otherwise, the return value is undefined.
.. versionadded:: 3.12
2 changes: 1 addition & 1 deletion Doc/c-api/monitoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ would typically correspond to a python function.
The ``version`` argument is a pointer to a value which should be allocated
by the user together with ``state_array`` and initialized to 0,
and then set only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this
and then set only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this
function to determine whether event states have changed since the previous call,
and to return quickly if they have not.
Expand Down
Loading

0 comments on commit 9e3b098

Please sign in to comment.