Skip to content

Commit 65cec93

Browse files
committed
Merge branch 'main' into gh-136396-fix-instrumentation
2 parents 59b96cc + a68ddea commit 65cec93

File tree

126 files changed

+3221
-795
lines changed

Some content is hidden

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

126 files changed

+3221
-795
lines changed

.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/ccache-action@v1.2
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: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
@@ -159,7 +159,7 @@ message body, instead setting the payload to the raw body.
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

Doc/library/functools.rst

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,18 @@ The :mod:`functools` module defines the following functions:
199199
and *typed*. This is for information purposes only. Mutating the values
200200
has no effect.
201201

202+
.. method:: lru_cache.cache_info()
203+
:no-typesetting:
204+
202205
To help measure the effectiveness of the cache and tune the *maxsize*
203-
parameter, the wrapped function is instrumented with a :func:`cache_info`
206+
parameter, the wrapped function is instrumented with a :func:`!cache_info`
204207
function that returns a :term:`named tuple` showing *hits*, *misses*,
205208
*maxsize* and *currsize*.
206209

207-
The decorator also provides a :func:`cache_clear` function for clearing or
210+
.. method:: lru_cache.cache_clear()
211+
:no-typesetting:
212+
213+
The decorator also provides a :func:`!cache_clear` function for clearing or
208214
invalidating the cache.
209215

210216
The original underlying function is accessible through the
@@ -284,9 +290,9 @@ The :mod:`functools` module defines the following functions:
284290
class decorator supplies the rest. This simplifies the effort involved
285291
in specifying all of the possible rich comparison operations:
286292

287-
The class must define one of :meth:`__lt__`, :meth:`__le__`,
288-
:meth:`__gt__`, or :meth:`__ge__`.
289-
In addition, the class should supply an :meth:`__eq__` method.
293+
The class must define one of :meth:`~object.__lt__`, :meth:`~object.__le__`,
294+
:meth:`~object.__gt__`, or :meth:`~object.__ge__`.
295+
In addition, the class should supply an :meth:`~object.__eq__` method.
290296

291297
For example::
292298

@@ -418,7 +424,7 @@ The :mod:`functools` module defines the following functions:
418424
like normal functions, are handled as descriptors).
419425

420426
When *func* is a descriptor (such as a normal Python function,
421-
:func:`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or
427+
:func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or
422428
another instance of :class:`partialmethod`), calls to ``__get__`` are
423429
delegated to the underlying descriptor, and an appropriate
424430
:ref:`partial object<partial-objects>` returned as the result.
@@ -499,7 +505,10 @@ The :mod:`functools` module defines the following functions:
499505
... print("Let me just say,", end=" ")
500506
... print(arg)
501507

502-
To add overloaded implementations to the function, use the :func:`register`
508+
.. method:: singledispatch.register()
509+
:no-typesetting:
510+
511+
To add overloaded implementations to the function, use the :func:`!register`
503512
attribute of the generic function, which can be used as a decorator. For
504513
functions annotated with types, the decorator will infer the type of the
505514
first argument automatically::
@@ -565,14 +574,14 @@ The :mod:`functools` module defines the following functions:
565574
runtime impact.
566575

567576
To enable registering :term:`lambdas<lambda>` and pre-existing functions,
568-
the :func:`register` attribute can also be used in a functional form::
577+
the :func:`~singledispatch.register` attribute can also be used in a functional form::
569578

570579
>>> def nothing(arg, verbose=False):
571580
... print("Nothing.")
572581
...
573582
>>> fun.register(type(None), nothing)
574583

575-
The :func:`register` attribute returns the undecorated function. This
584+
The :func:`~singledispatch.register` attribute returns the undecorated function. This
576585
enables decorator stacking, :mod:`pickling<pickle>`, and the creation
577586
of unit tests for each variant independently::
578587

@@ -650,10 +659,10 @@ The :mod:`functools` module defines the following functions:
650659
.. versionadded:: 3.4
651660

652661
.. versionchanged:: 3.7
653-
The :func:`register` attribute now supports using type annotations.
662+
The :func:`~singledispatch.register` attribute now supports using type annotations.
654663

655664
.. versionchanged:: 3.11
656-
The :func:`register` attribute now supports
665+
The :func:`~singledispatch.register` attribute now supports
657666
:class:`typing.Union` as a type annotation.
658667

659668

@@ -783,7 +792,7 @@ The :mod:`functools` module defines the following functions:
783792
'Docstring'
784793

785794
Without the use of this decorator factory, the name of the example function
786-
would have been ``'wrapper'``, and the docstring of the original :func:`example`
795+
would have been ``'wrapper'``, and the docstring of the original :func:`!example`
787796
would have been lost.
788797

789798

0 commit comments

Comments
 (0)