Skip to content

Commit 0c39304

Browse files
authored
Merge branch 'python:main' into zipimport
2 parents f7bea5d + 759a54d commit 0c39304

File tree

75 files changed

+1751
-803
lines changed

Some content is hidden

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

75 files changed

+1751
-803
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@ jobs:
4040
if: fromJSON(needs.check_source.outputs.run-docs)
4141
uses: ./.github/workflows/reusable-docs.yml
4242

43+
check_autoconf_regen:
44+
name: 'Check if Autoconf files are up to date'
45+
# Don't use ubuntu-latest but a specific version to make the job
46+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
47+
runs-on: ubuntu-24.04
48+
container:
49+
image: ghcr.io/python/autoconf:2024.10.11.11293396815
50+
timeout-minutes: 60
51+
needs: check_source
52+
if: needs.check_source.outputs.run_tests == 'true'
53+
steps:
54+
- name: Install Git
55+
run: |
56+
apt install git -yq
57+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 1
61+
- name: Runner image version
62+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
63+
- name: Check Autoconf and aclocal versions
64+
run: |
65+
grep "Generated by GNU Autoconf 2.71" configure
66+
grep "aclocal 1.16.5" aclocal.m4
67+
grep -q "runstatedir" configure
68+
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
69+
- name: Regenerate autoconf files
70+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
71+
run: autoreconf -ivf -Werror
72+
- name: Check for changes
73+
run: |
74+
git add -u
75+
changes=$(git status --porcelain)
76+
# Check for changes in regenerated files
77+
if test -n "$changes"; then
78+
echo "Generated files not up to date."
79+
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
80+
echo "configure files must be regenerated with a specific version of autoconf."
81+
echo "$changes"
82+
echo ""
83+
git diff --staged || true
84+
exit 1
85+
fi
86+
4387
check_generated_files:
4488
name: 'Check if generated files are up to date'
4589
# Don't use ubuntu-latest but a specific version to make the job
@@ -69,19 +113,10 @@ jobs:
69113
uses: hendrikmuhs/[email protected]
70114
with:
71115
save: false
72-
- name: Check Autoconf and aclocal versions
73-
run: |
74-
grep "Generated by GNU Autoconf 2.71" configure
75-
grep "aclocal 1.16.5" aclocal.m4
76-
grep -q "runstatedir" configure
77-
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
78116
- name: Configure CPython
79117
run: |
80118
# Build Python with the libpython dynamic library
81119
./configure --config-cache --with-pydebug --enable-shared
82-
- name: Regenerate autoconf files
83-
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
84-
run: autoreconf -ivf -Werror
85120
- name: Build CPython
86121
run: |
87122
make -j4 regen-all
@@ -501,6 +536,7 @@ jobs:
501536
needs:
502537
- check_source # Transitive dependency, needed to access `run_tests` value
503538
- check-docs
539+
- check_autoconf_regen
504540
- check_generated_files
505541
- build_macos
506542
- build_ubuntu
@@ -536,6 +572,7 @@ jobs:
536572
${{
537573
needs.check_source.outputs.run_tests != 'true'
538574
&& '
575+
check_autoconf_regen,
539576
check_generated_files,
540577
build_macos,
541578
build_ubuntu,

.github/workflows/posix-deps-apt.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/bin/sh
22
apt-get update
33

4-
# autoconf-archive is needed by autoreconf (check_generated_files job)
54
apt-get -yq install \
65
build-essential \
76
pkg-config \
8-
autoconf-archive \
97
ccache \
108
gdb \
119
lcov \

Doc/c-api/init.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ Process-wide parameters
625625
returned string points into static storage; the caller should not modify its
626626
value. This corresponds to the :makevar:`prefix` variable in the top-level
627627
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
628-
script at build time. The value is available to Python code as ``sys.prefix``.
628+
script at build time. The value is available to Python code as ``sys.base_prefix``.
629629
It is only useful on Unix. See also the next function.
630630
631631
This function should not be called before :c:func:`Py_Initialize`, otherwise
@@ -635,7 +635,8 @@ Process-wide parameters
635635
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
636636
637637
.. deprecated-removed:: 3.13 3.15
638-
Get :data:`sys.prefix` instead.
638+
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
639+
:ref:`virtual environments <venv-def>` need to be handled.
639640
640641
641642
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -648,7 +649,8 @@ Process-wide parameters
648649
should not modify its value. This corresponds to the :makevar:`exec_prefix`
649650
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
650651
argument to the :program:`configure` script at build time. The value is
651-
available to Python code as ``sys.exec_prefix``. It is only useful on Unix.
652+
available to Python code as ``sys.base_exec_prefix``. It is only useful on
653+
Unix.
652654
653655
Background: The exec-prefix differs from the prefix when platform dependent
654656
files (such as executables and shared libraries) are installed in a different
@@ -679,7 +681,8 @@ Process-wide parameters
679681
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
680682
681683
.. deprecated-removed:: 3.13 3.15
682-
Get :data:`sys.exec_prefix` instead.
684+
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
685+
:ref:`virtual environments <venv-def>` need to be handled.
683686
684687
685688
.. c:function:: wchar_t* Py_GetProgramFullPath()
@@ -2418,7 +2421,7 @@ Example usage::
24182421
24192422
In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which
24202423
can call arbitrary code through an object's deallocation function. The critical
2421-
section API avoids potentital deadlocks due to reentrancy and lock ordering
2424+
section API avoids potential deadlocks due to reentrancy and lock ordering
24222425
by allowing the runtime to temporarily suspend the critical section if the
24232426
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
24242427

Doc/c-api/long.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
511511
free(bignum);
512512
513513
*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults
514-
that behave most like a C cast, or a combintation of the other flags in
514+
that behave most like a C cast, or a combination of the other flags in
515515
the table below.
516516
Note that ``-1`` cannot be combined with other flags.
517517

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ would typically correspond to a python function.
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 :c:func:`!PyMonitoring_EnterScope` itelf. It allows this
150+
and then set only by :c:func:`!PyMonitoring_EnterScope` itself. 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

Doc/c-api/typeobj.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,19 @@ and :c:data:`PyType_Type` effectively act as defaults.)
682682
Py_DECREF(tp);
683683
}
684684
685+
.. warning::
686+
687+
In a garbage collected Python, :c:member:`!tp_dealloc` may be called from
688+
any Python thread, not just the thread which created the object (if the
689+
object becomes part of a refcount cycle, that cycle might be collected by
690+
a garbage collection on any thread). This is not a problem for Python
691+
API calls, since the thread on which :c:member:`!tp_dealloc` is called
692+
will own the Global Interpreter Lock (GIL). However, if the object being
693+
destroyed in turn destroys objects from some other C or C++ library, care
694+
should be taken to ensure that destroying those objects on the thread
695+
which called :c:member:`!tp_dealloc` will not violate any assumptions of
696+
the library.
697+
685698

686699
**Inheritance:**
687700

@@ -2109,17 +2122,6 @@ and :c:data:`PyType_Type` effectively act as defaults.)
21092122
PyErr_Restore(error_type, error_value, error_traceback);
21102123
}
21112124

2112-
Also, note that, in a garbage collected Python,
2113-
:c:member:`~PyTypeObject.tp_dealloc` may be called from
2114-
any Python thread, not just the thread which created the object (if the object
2115-
becomes part of a refcount cycle, that cycle might be collected by a garbage
2116-
collection on any thread). This is not a problem for Python API calls, since
2117-
the thread on which tp_dealloc is called will own the Global Interpreter Lock
2118-
(GIL). However, if the object being destroyed in turn destroys objects from some
2119-
other C or C++ library, care should be taken to ensure that destroying those
2120-
objects on the thread which called tp_dealloc will not violate any assumptions
2121-
of the library.
2122-
21232125
**Inheritance:**
21242126

21252127
This field is inherited by subtypes.

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Pending removal in Python 3.15
1313
* :c:func:`PySys_ResetWarnOptions`:
1414
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
1515
* :c:func:`Py_GetExecPrefix`:
16-
Get :data:`sys.exec_prefix` instead.
16+
Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead.
1717
* :c:func:`Py_GetPath`:
1818
Get :data:`sys.path` instead.
1919
* :c:func:`Py_GetPrefix`:
20-
Get :data:`sys.prefix` instead.
20+
Get :data:`sys.base_prefix` and :data:`sys.prefix` instead.
2121
* :c:func:`Py_GetProgramFullPath`:
2222
Get :data:`sys.executable` instead.
2323
* :c:func:`Py_GetProgramName`:

Doc/library/builtins.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
--------------
88

99
This module provides direct access to all 'built-in' identifiers of Python; for
10-
example, ``builtins.open`` is the full name for the built-in function
11-
:func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for
12-
documentation.
13-
10+
example, ``builtins.open`` is the full name for the built-in function :func:`open`.
1411

1512
This module is not normally accessed explicitly by most applications, but can be
1613
useful in modules that provide objects with the same name as a built-in value,
@@ -40,3 +37,10 @@ available as part of their globals. The value of ``__builtins__`` is normally
4037
either this module or the value of this module's :attr:`~object.__dict__` attribute.
4138
Since this is an implementation detail, it may not be used by alternate
4239
implementations of Python.
40+
41+
.. seealso::
42+
43+
* :ref:`built-in-consts`
44+
* :ref:`bltin-exceptions`
45+
* :ref:`built-in-funcs`
46+
* :ref:`bltin-types`

Doc/library/concurrent.futures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ ThreadPoolExecutor Example
208208
'http://www.cnn.com/',
209209
'http://europe.wsj.com/',
210210
'http://www.bbc.co.uk/',
211-
'http://nonexistant-subdomain.python.org/']
211+
'http://nonexistent-subdomain.python.org/']
212212

213213
# Retrieve a single page and report the URL and contents
214214
def load_url(url, timeout):

Doc/library/functions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,10 @@ are always available. They are listed here in alphabetical order.
20322032
:func:`super`, see `guide to using super()
20332033
<https://rhettinger.wordpress.com/2011/05/26/super-considered-super/>`_.
20342034

2035+
.. versionchanged:: 3.14
2036+
:class:`super` objects are now :mod:`pickleable <pickle>` and
2037+
:mod:`copyable <copy>`.
2038+
20352039

20362040
.. _func-tuple:
20372041
.. class:: tuple()

0 commit comments

Comments
 (0)