Skip to content

Commit 109ff8b

Browse files
Merge remote-tracking branch 'upstream/main' into dict
2 parents 7a858d6 + 180b3eb commit 109ff8b

File tree

187 files changed

+3934
-1126
lines changed

Some content is hidden

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

187 files changed

+3934
-1126
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.{py,c,cpp,h,js,rst,md,yml,yaml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,cpp,h}]
8+
[*.{py,c,cpp,h,gram}]
99
indent_size = 4
1010

1111
[*.rst]

.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 \

.github/workflows/reusable-docs.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
run: |
6767
set -Eeuo pipefail
6868
# Build docs with the nit-picky option; write warnings to file
69-
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --warning-file sphinx-warnings.txt" html
69+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
7070
- name: 'Check warnings'
7171
if: github.event_name == 'pull_request'
7272
run: |
@@ -75,6 +75,18 @@ jobs:
7575
--fail-if-regression \
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
78+
- name: 'Build EPUB documentation'
79+
continue-on-error: true
80+
run: |
81+
set -Eeuo pipefail
82+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet" epub
83+
pip install epubcheck
84+
epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
85+
- name: 'Check for fatal errors in EPUB'
86+
if: github.event_name == 'pull_request'
87+
continue-on-error: true # until gh-136155 is fixed
88+
run: |
89+
python Doc/tools/check-epub.py
7890
7991
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
8092
doctest:

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/float.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ There are two problems on non-IEEE platforms:
124124
* What this does is undefined if *x* is a NaN or infinity.
125125
* ``-0.0`` and ``+0.0`` produce the same bytes string.
126126
127-
.. c:function:: int PyFloat_Pack2(double x, unsigned char *p, int le)
127+
.. c:function:: int PyFloat_Pack2(double x, char *p, int le)
128128
129129
Pack a C double as the IEEE 754 binary16 half-precision format.
130130
131-
.. c:function:: int PyFloat_Pack4(double x, unsigned char *p, int le)
131+
.. c:function:: int PyFloat_Pack4(double x, char *p, int le)
132132
133133
Pack a C double as the IEEE 754 binary32 single precision format.
134134
135-
.. c:function:: int PyFloat_Pack8(double x, unsigned char *p, int le)
135+
.. c:function:: int PyFloat_Pack8(double x, char *p, int le)
136136
137137
Pack a C double as the IEEE 754 binary64 double precision format.
138138
@@ -154,14 +154,14 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
154154
Note that on a non-IEEE platform this will refuse to unpack a bytes string that
155155
represents a NaN or infinity.
156156
157-
.. c:function:: double PyFloat_Unpack2(const unsigned char *p, int le)
157+
.. c:function:: double PyFloat_Unpack2(const char *p, int le)
158158
159159
Unpack the IEEE 754 binary16 half-precision format as a C double.
160160
161-
.. c:function:: double PyFloat_Unpack4(const unsigned char *p, int le)
161+
.. c:function:: double PyFloat_Unpack4(const char *p, int le)
162162
163163
Unpack the IEEE 754 binary32 single precision format as a C double.
164164
165-
.. c:function:: double PyFloat_Unpack8(const unsigned char *p, int le)
165+
.. c:function:: double PyFloat_Unpack8(const char *p, int le)
166166
167167
Unpack the IEEE 754 binary64 double precision format as a C double.

Doc/c-api/init_config.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,7 @@ PyPreConfig
975975
Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option
976976
and the :envvar:`PYTHONUTF8` environment variable.
977977
978-
Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``.
979-
980-
Default: ``-1`` in Python config and ``0`` in isolated config.
978+
Default: ``1``.
981979
982980
983981
.. _c-preinit:

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/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@
448448

449449
epub_author = 'Python Documentation Authors'
450450
epub_publisher = 'Python Software Foundation'
451+
epub_exclude_files = ('index.xhtml', 'download.xhtml')
451452

452453
# index pages are not valid xhtml
453454
# https://github.com/sphinx-doc/sphinx/issues/12359

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.

0 commit comments

Comments
 (0)