Skip to content

Commit ad8db83

Browse files
authored
Merge branch 'main' into emscripten-uid-match-native
2 parents 789681e + b74fb8e commit ad8db83

File tree

147 files changed

+6493
-812
lines changed

Some content is hidden

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

147 files changed

+6493
-812
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Modules/Setup* @erlend-aasland
2727
**/*genobject* @markshannon
2828
**/*hamt* @1st1
2929
**/*jit* @brandtbucher @savannahostrowski @diegorusso
30+
Python/perf_jit_trampoline.c # Exclude the owners of "**/*jit*", above.
3031
Objects/set* @rhettinger
3132
Objects/dict* @methane @markshannon
3233
Objects/typevarobject.c @JelleZijlstra

.github/workflows/build.yml

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ jobs:
260260
free-threading: ${{ matrix.free-threading }}
261261
os: ${{ matrix.os }}
262262

263-
build-ubuntu-ssltests:
263+
build-ubuntu-ssltests-openssl:
264264
name: 'Ubuntu SSL tests with OpenSSL'
265265
runs-on: ${{ matrix.os }}
266266
timeout-minutes: 60
@@ -322,6 +322,81 @@ jobs:
322322
- name: SSL tests
323323
run: ./python Lib/test/ssltests.py
324324

325+
build-ubuntu-ssltests-awslc:
326+
name: 'Ubuntu SSL tests with AWS-LC'
327+
runs-on: ${{ matrix.os }}
328+
timeout-minutes: 60
329+
needs: build-context
330+
if: needs.build-context.outputs.run-tests == 'true'
331+
strategy:
332+
fail-fast: false
333+
matrix:
334+
os: [ubuntu-24.04]
335+
awslc_ver: [1.55.0]
336+
env:
337+
AWSLC_VER: ${{ matrix.awslc_ver}}
338+
MULTISSL_DIR: ${{ github.workspace }}/multissl
339+
OPENSSL_DIR: ${{ github.workspace }}/multissl/aws-lc/${{ matrix.awslc_ver }}
340+
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/aws-lc/${{ matrix.awslc_ver }}/lib
341+
steps:
342+
- uses: actions/checkout@v4
343+
with:
344+
persist-credentials: false
345+
- name: Runner image version
346+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
347+
- name: Restore config.cache
348+
uses: actions/cache@v4
349+
with:
350+
path: config.cache
351+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
352+
- name: Register gcc problem matcher
353+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
354+
- name: Install dependencies
355+
run: sudo ./.github/workflows/posix-deps-apt.sh
356+
- name: Configure SSL lib env vars
357+
run: |
358+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
359+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/aws-lc/${AWSLC_VER}" >> "$GITHUB_ENV"
360+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/aws-lc/${AWSLC_VER}/lib" >> "$GITHUB_ENV"
361+
- name: 'Restore AWS-LC build'
362+
id: cache-aws-lc
363+
uses: actions/cache@v4
364+
with:
365+
path: ./multissl/aws-lc/${{ matrix.awslc_ver }}
366+
key: ${{ matrix.os }}-multissl-aws-lc-${{ matrix.awslc_ver }}
367+
- name: Install AWS-LC
368+
if: steps.cache-aws-lc.outputs.cache-hit != 'true'
369+
run: |
370+
python3 Tools/ssl/multissltests.py \
371+
--steps=library \
372+
--base-directory "$MULTISSL_DIR" \
373+
--awslc ${{ matrix.awslc_ver }} \
374+
--system Linux
375+
- name: Add ccache to PATH
376+
run: |
377+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
378+
- name: Configure ccache action
379+
uses: hendrikmuhs/[email protected]
380+
with:
381+
save: false
382+
- name: Configure CPython
383+
run: |
384+
./configure CFLAGS="-fdiagnostics-format=json" \
385+
--config-cache \
386+
--enable-slower-safety \
387+
--with-pydebug \
388+
--with-openssl="$OPENSSL_DIR" \
389+
--with-builtin-hashlib-hashes=blake2 \
390+
--with-ssl-default-suites=openssl
391+
- name: Build CPython
392+
run: make -j
393+
- name: Display build info
394+
run: make pythoninfo
395+
- name: Verify python is linked to AWS-LC
396+
run: ./python -c 'import ssl; print(ssl.OPENSSL_VERSION)' | grep AWS-LC
397+
- name: SSL tests
398+
run: ./python Lib/test/ssltests.py
399+
325400
build-wasi:
326401
name: 'WASI'
327402
needs: build-context
@@ -628,7 +703,8 @@ jobs:
628703
- build-windows-msi
629704
- build-macos
630705
- build-ubuntu
631-
- build-ubuntu-ssltests
706+
- build-ubuntu-ssltests-awslc
707+
- build-ubuntu-ssltests-openssl
632708
- build-wasi
633709
- test-hypothesis
634710
- build-asan
@@ -643,7 +719,8 @@ jobs:
643719
with:
644720
allowed-failures: >-
645721
build-windows-msi,
646-
build-ubuntu-ssltests,
722+
build-ubuntu-ssltests-awslc,
723+
build-ubuntu-ssltests-openssl,
647724
test-hypothesis,
648725
cifuzz,
649726
allowed-skips: >-
@@ -661,7 +738,8 @@ jobs:
661738
check-generated-files,
662739
build-macos,
663740
build-ubuntu,
664-
build-ubuntu-ssltests,
741+
build-ubuntu-ssltests-awslc,
742+
build-ubuntu-ssltests-openssl,
665743
build-wasi,
666744
test-hypothesis,
667745
build-asan,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apt-get -yq install \
55
build-essential \
66
pkg-config \
77
ccache \
8+
cmake \
89
gdb \
910
lcov \
1011
libb2-dev \

Doc/c-api/arg.rst

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ the Python object to the required type.
241241

242242
For signed integer formats, :exc:`OverflowError` is raised if the value
243243
is out of range for the C type.
244-
For unsigned integer formats, no range checking is done --- the
244+
For unsigned integer formats, the
245245
most significant bits are silently truncated when the receiving field is too
246-
small to receive the value.
246+
small to receive the value, and :exc:`DeprecationWarning` is emitted when
247+
the value is larger than the maximal value for the C type or less than
248+
the minimal value for the corresponding signed integer type of the same size.
247249

248250
``b`` (:class:`int`) [unsigned char]
249251
Convert a nonnegative Python integer to an unsigned tiny integer, stored in a C
@@ -252,27 +254,25 @@ small to receive the value.
252254
``B`` (:class:`int`) [unsigned char]
253255
Convert a Python integer to a tiny integer without overflow checking, stored in a C
254256
:c:expr:`unsigned char`.
257+
Convert a Python integer to a C :c:expr:`unsigned char`.
255258

256259
``h`` (:class:`int`) [short int]
257260
Convert a Python integer to a C :c:expr:`short int`.
258261

259262
``H`` (:class:`int`) [unsigned short int]
260-
Convert a Python integer to a C :c:expr:`unsigned short int`, without overflow
261-
checking.
263+
Convert a Python integer to a C :c:expr:`unsigned short int`.
262264

263265
``i`` (:class:`int`) [int]
264266
Convert a Python integer to a plain C :c:expr:`int`.
265267

266268
``I`` (:class:`int`) [unsigned int]
267-
Convert a Python integer to a C :c:expr:`unsigned int`, without overflow
268-
checking.
269+
Convert a Python integer to a C :c:expr:`unsigned int`.
269270

270271
``l`` (:class:`int`) [long int]
271272
Convert a Python integer to a C :c:expr:`long int`.
272273

273274
``k`` (:class:`int`) [unsigned long]
274-
Convert a Python integer to a C :c:expr:`unsigned long` without
275-
overflow checking.
275+
Convert a Python integer to a C :c:expr:`unsigned long`.
276276

277277
.. versionchanged:: 3.14
278278
Use :meth:`~object.__index__` if available.
@@ -281,8 +281,7 @@ small to receive the value.
281281
Convert a Python integer to a C :c:expr:`long long`.
282282

283283
``K`` (:class:`int`) [unsigned long long]
284-
Convert a Python integer to a C :c:expr:`unsigned long long`
285-
without overflow checking.
284+
Convert a Python integer to a C :c:expr:`unsigned long long`.
286285

287286
.. versionchanged:: 3.14
288287
Use :meth:`~object.__index__` if available.
@@ -310,6 +309,14 @@ small to receive the value.
310309
``D`` (:class:`complex`) [Py_complex]
311310
Convert a Python complex number to a C :c:type:`Py_complex` structure.
312311

312+
.. deprecated:: next
313+
314+
For unsigned integer formats ``B``, ``H``, ``I``, ``k`` and ``K``,
315+
:exc:`DeprecationWarning` is emitted when the value is larger than
316+
the maximal value for the C type or less than the minimal value for
317+
the corresponding signed integer type of the same size.
318+
319+
313320
Other objects
314321
-------------
315322

Doc/c-api/object.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,20 +611,22 @@ Object Protocol
611611
if supported by the runtime. In the :term:`free-threaded <free threading>` build,
612612
this allows the interpreter to avoid reference count adjustments to *obj*,
613613
which may improve multi-threaded performance. The tradeoff is
614-
that *obj* will only be deallocated by the tracing garbage collector.
614+
that *obj* will only be deallocated by the tracing garbage collector, and
615+
not when the interpreter no longer has any references to it.
615616
616-
This function returns ``1`` if deferred reference counting is enabled on *obj*
617-
(including when it was enabled before the call),
617+
This function returns ``1`` if deferred reference counting is enabled on *obj*,
618618
and ``0`` if deferred reference counting is not supported or if the hint was
619-
ignored by the runtime. This function is thread-safe, and cannot fail.
619+
ignored by the interpreter, such as when deferred reference counting is already
620+
enabled on *obj*. This function is thread-safe, and cannot fail.
620621
621622
This function does nothing on builds with the :term:`GIL` enabled, which do
622623
not support deferred reference counting. This also does nothing if *obj* is not
623624
an object tracked by the garbage collector (see :func:`gc.is_tracked` and
624625
:c:func:`PyObject_GC_IsTracked`).
625626
626627
This function is intended to be used soon after *obj* is created,
627-
by the code that creates it.
628+
by the code that creates it, such as in the object's :c:member:`~PyTypeObject.tp_new`
629+
slot.
628630
629631
.. versionadded:: 3.14
630632

Doc/glossary.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,11 @@ Glossary
12081208
:func:`sys.getrefcount` function to return the
12091209
reference count for a particular object.
12101210

1211+
In :term:`CPython`, reference counts are not considered to be stable
1212+
or well-defined values; the number of references to an object, and how
1213+
that number is affected by Python code, may be different between
1214+
versions.
1215+
12111216
regular package
12121217
A traditional :term:`package`, such as a directory containing an
12131218
``__init__.py`` file.

Doc/library/codecs.rst

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ wider range of codecs when working with binary files:
243243
.. function:: iterencode(iterator, encoding, errors='strict', **kwargs)
244244

245245
Uses an incremental encoder to iteratively encode the input provided by
246-
*iterator*. This function is a :term:`generator`.
247-
The *errors* argument (as well as any
246+
*iterator*. *iterator* must yield :class:`str` objects.
247+
This function is a :term:`generator`. The *errors* argument (as well as any
248248
other keyword argument) is passed through to the incremental encoder.
249249

250250
This function requires that the codec accept text :class:`str` objects
@@ -255,8 +255,8 @@ wider range of codecs when working with binary files:
255255
.. function:: iterdecode(iterator, encoding, errors='strict', **kwargs)
256256

257257
Uses an incremental decoder to iteratively decode the input provided by
258-
*iterator*. This function is a :term:`generator`.
259-
The *errors* argument (as well as any
258+
*iterator*. *iterator* must yield :class:`bytes` objects.
259+
This function is a :term:`generator`. The *errors* argument (as well as any
260260
other keyword argument) is passed through to the incremental decoder.
261261

262262
This function requires that the codec accept :class:`bytes` objects
@@ -1065,8 +1065,15 @@ or with dictionaries as mapping tables. The following table lists the codecs by
10651065
name, together with a few common aliases, and the languages for which the
10661066
encoding is likely used. Neither the list of aliases nor the list of languages
10671067
is meant to be exhaustive. Notice that spelling alternatives that only differ in
1068-
case or use a hyphen instead of an underscore are also valid aliases; therefore,
1069-
e.g. ``'utf-8'`` is a valid alias for the ``'utf_8'`` codec.
1068+
case or use a hyphen instead of an underscore are also valid aliases
1069+
because they are equivalent when normalized by
1070+
:func:`~encodings.normalize_encoding`. For example, ``'utf-8'`` is a valid
1071+
alias for the ``'utf_8'`` codec.
1072+
1073+
.. note::
1074+
1075+
The below table lists the most common aliases, for a complete list
1076+
refer to the source :source:`aliases.py <Lib/encodings/aliases.py>` file.
10701077

10711078
On Windows, ``cpXXX`` codecs are available for all code pages.
10721079
But only codecs listed in the following table are guarantead to exist on
@@ -1395,7 +1402,11 @@ encodings.
13951402
| | | It is used in the Python |
13961403
| | | pickle protocol. |
13971404
+--------------------+---------+---------------------------+
1398-
| undefined | | Raise an exception for |
1405+
| undefined | | This Codec should only |
1406+
| | | be used for testing |
1407+
| | | purposes. |
1408+
| | | |
1409+
| | | Raise an exception for |
13991410
| | | all conversions, even |
14001411
| | | empty strings. The error |
14011412
| | | handler is ignored. |

Doc/library/concurrent.interpreters.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
.. versionadded:: 3.14
1111

12-
**Source code:** :source:`Lib/concurrent/interpreters.py`
12+
**Source code:** :source:`Lib/concurrent/interpreters`
1313

1414
--------------
1515

Doc/library/email.parser.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ methods.
4848
FeedParser API
4949
^^^^^^^^^^^^^^
5050

51-
The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` module,
52-
provides an API that is conducive to incremental parsing of email messages,
51+
The :class:`BytesFeedParser`, imported from the :mod:`email.parser.FeedParser`
52+
module, provides an API that is conducive to incremental parsing of email messages,
5353
such as would be necessary when reading the text of an email message from a
5454
source that can block (such as a socket). The :class:`BytesFeedParser` can of
5555
course be used to parse an email message fully contained in a :term:`bytes-like
@@ -116,7 +116,7 @@ Here is the API for the :class:`BytesFeedParser`:
116116
Works like :class:`BytesFeedParser` except that the input to the
117117
:meth:`~BytesFeedParser.feed` method must be a string. This is of limited
118118
utility, since the only way for such a message to be valid is for it to
119-
contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is
119+
contain only ASCII text or, if :attr:`~email.policy.EmailPolicy.utf8` is
120120
``True``, no binary attachments.
121121

122122
.. versionchanged:: 3.3 Added the *policy* keyword.
@@ -155,11 +155,11 @@ message body, instead setting the payload to the raw body.
155155

156156
Read all the data from the binary file-like object *fp*, parse the
157157
resulting bytes, and return the message object. *fp* must support
158-
both the :meth:`~io.IOBase.readline` and the :meth:`~io.IOBase.read`
158+
both the :meth:`~io.IOBase.readline` and the :meth:`~io.TextIOBase.read`
159159
methods.
160160

161161
The bytes contained in *fp* must be formatted as a block of :rfc:`5322`
162-
(or, if :attr:`~email.policy.Policy.utf8` is ``True``, :rfc:`6532`)
162+
(or, if :attr:`~email.policy.EmailPolicy.utf8` is ``True``, :rfc:`6532`)
163163
style headers and header continuation lines, optionally preceded by an
164164
envelope header. The header block is terminated either by the end of the
165165
data or by a blank line. Following the header block is the body of the

0 commit comments

Comments
 (0)