Skip to content

Commit c5a1146

Browse files
authored
Merge branch 'main' into ssl-group-support
2 parents e0baf56 + 69ea1b3 commit c5a1146

File tree

389 files changed

+10486
-2981
lines changed

Some content is hidden

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

389 files changed

+10486
-2981
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/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Modules/Setup* @erlend-aasland
2626
**/*context* @1st1
2727
**/*genobject* @markshannon
2828
**/*hamt* @1st1
29-
**/*jit* @brandtbucher @savannahostrowski
29+
**/*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/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 \

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

Android/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def unpack_deps(host, prefix_dir):
175175
os.chdir(prefix_dir)
176176
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
177177
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.15-4",
178-
"sqlite-3.49.1-0", "xz-5.4.6-1"]:
178+
"sqlite-3.49.1-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
179179
filename = f"{name_ver}-{host}.tar.gz"
180180
download(f"{deps_url}/{name_ver}/{filename}")
181181
shutil.unpack_archive(filename)

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,71 @@ bound into a function.
211211
.. versionadded:: 3.12
212212
213213
214+
.. _c_codeobject_flags:
215+
216+
Code Object Flags
217+
-----------------
218+
219+
Code objects contain a bit-field of flags, which can be retrieved as the
220+
:attr:`~codeobject.co_flags` Python attribute (for example using
221+
:c:func:`PyObject_GetAttrString`), and set using a *flags* argument to
222+
:c:func:`PyUnstable_Code_New` and similar functions.
223+
224+
Flags whose names start with ``CO_FUTURE_`` correspond to features normally
225+
selectable by :ref:`future statements <future>`. These flags can be used in
226+
:c:member:`PyCompilerFlags.cf_flags`.
227+
Note that many ``CO_FUTURE_`` flags are mandatory in current versions of
228+
Python, and setting them has no effect.
229+
230+
The following flags are available.
231+
For their meaning, see the linked documentation of their Python equivalents.
232+
233+
234+
.. list-table::
235+
:widths: auto
236+
:header-rows: 1
237+
238+
* * Flag
239+
* Meaning
240+
* * .. c:macro:: CO_OPTIMIZED
241+
* :py:data:`inspect.CO_OPTIMIZED`
242+
* * .. c:macro:: CO_NEWLOCALS
243+
* :py:data:`inspect.CO_NEWLOCALS`
244+
* * .. c:macro:: CO_VARARGS
245+
* :py:data:`inspect.CO_VARARGS`
246+
* * .. c:macro:: CO_VARKEYWORDS
247+
* :py:data:`inspect.CO_VARKEYWORDS`
248+
* * .. c:macro:: CO_NESTED
249+
* :py:data:`inspect.CO_NESTED`
250+
* * .. c:macro:: CO_GENERATOR
251+
* :py:data:`inspect.CO_GENERATOR`
252+
* * .. c:macro:: CO_COROUTINE
253+
* :py:data:`inspect.CO_COROUTINE`
254+
* * .. c:macro:: CO_ITERABLE_COROUTINE
255+
* :py:data:`inspect.CO_ITERABLE_COROUTINE`
256+
* * .. c:macro:: CO_ASYNC_GENERATOR
257+
* :py:data:`inspect.CO_ASYNC_GENERATOR`
258+
* * .. c:macro:: CO_HAS_DOCSTRING
259+
* :py:data:`inspect.CO_HAS_DOCSTRING`
260+
* * .. c:macro:: CO_METHOD
261+
* :py:data:`inspect.CO_METHOD`
262+
263+
* * .. c:macro:: CO_FUTURE_DIVISION
264+
* no effect (:py:data:`__future__.division`)
265+
* * .. c:macro:: CO_FUTURE_ABSOLUTE_IMPORT
266+
* no effect (:py:data:`__future__.absolute_import`)
267+
* * .. c:macro:: CO_FUTURE_WITH_STATEMENT
268+
* no effect (:py:data:`__future__.with_statement`)
269+
* * .. c:macro:: CO_FUTURE_PRINT_FUNCTION
270+
* no effect (:py:data:`__future__.print_function`)
271+
* * .. c:macro:: CO_FUTURE_UNICODE_LITERALS
272+
* no effect (:py:data:`__future__.unicode_literals`)
273+
* * .. c:macro:: CO_FUTURE_GENERATOR_STOP
274+
* no effect (:py:data:`__future__.generator_stop`)
275+
* * .. c:macro:: CO_FUTURE_ANNOTATIONS
276+
* :py:data:`__future__.annotations`
277+
278+
214279
Extra information
215280
-----------------
216281

0 commit comments

Comments
 (0)