Skip to content

Commit fe42d9a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into default-ssl-verify-flags
2 parents e46a672 + 321d13f commit fe42d9a

File tree

583 files changed

+20766
-7445
lines changed

Some content is hidden

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

583 files changed

+20766
-7445
lines changed

.editorconfig

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

3-
[*.{py,c,cpp,h,rst,md,yml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
@@ -11,5 +11,5 @@ indent_size = 4
1111
[*.rst]
1212
indent_size = 3
1313

14-
[*.yml]
14+
[*.{js,yml}]
1515
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Programs/test_frozenmain.h generated
9696
Python/Python-ast.c generated
9797
Python/executor_cases.c.h generated
9898
Python/generated_cases.c.h generated
99+
Python/tier2_redundancy_eliminator_bytecodes.c.h generated
99100
Python/opcode_targets.h generated
100101
Python/stdlib_module_names.h generated
101102
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Python/flowgraph.c @markshannon @iritkatriel
3737
Python/ast_opt.c @isidentical
3838
Python/bytecodes.c @markshannon @gvanrossum
3939
Python/optimizer*.c @markshannon @gvanrossum
40+
Python/optimizer_analysis.c @Fidget-Spinner
41+
Python/tier2_redundancy_eliminator_bytecodes.c @Fidget-Spinner
4042
Lib/test/test_patma.py @brandtbucher
4143
Lib/test/test_type_*.py @JelleZijlstra
4244
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum

.github/workflows/build.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,13 @@ jobs:
131131
- uses: actions/setup-python@v5
132132
with:
133133
python-version: '3.x'
134+
- name: Runner image version
135+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
134136
- name: Restore config.cache
135-
uses: actions/cache@v3
137+
uses: actions/cache@v4
136138
with:
137139
path: config.cache
138-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
140+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
139141
- name: Install Dependencies
140142
run: sudo ./.github/workflows/posix-deps-apt.sh
141143
- name: Add ccache to PATH
@@ -250,19 +252,21 @@ jobs:
250252
strategy:
251253
fail-fast: false
252254
matrix:
253-
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
255+
openssl_ver: [1.1.1w, 3.0.13, 3.1.5, 3.2.1]
254256
env:
255257
OPENSSL_VER: ${{ matrix.openssl_ver }}
256258
MULTISSL_DIR: ${{ github.workspace }}/multissl
257259
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
258260
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
259261
steps:
260262
- uses: actions/checkout@v4
263+
- name: Runner image version
264+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
261265
- name: Restore config.cache
262-
uses: actions/cache@v3
266+
uses: actions/cache@v4
263267
with:
264268
path: config.cache
265-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
269+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
266270
- name: Register gcc problem matcher
267271
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
268272
- name: Install Dependencies
@@ -274,7 +278,7 @@ jobs:
274278
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
275279
- name: 'Restore OpenSSL build'
276280
id: cache-openssl
277-
uses: actions/cache@v3
281+
uses: actions/cache@v4
278282
with:
279283
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
280284
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -304,7 +308,7 @@ jobs:
304308
needs: check_source
305309
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
306310
env:
307-
OPENSSL_VER: 3.0.11
311+
OPENSSL_VER: 3.0.13
308312
PYTHONSTRICTEXTENSIONBUILD: 1
309313
steps:
310314
- uses: actions/checkout@v4
@@ -319,7 +323,7 @@ jobs:
319323
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
320324
- name: 'Restore OpenSSL build'
321325
id: cache-openssl
322-
uses: actions/cache@v3
326+
uses: actions/cache@v4
323327
with:
324328
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
325329
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -341,11 +345,13 @@ jobs:
341345
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
342346
- name: Bind mount sources read-only
343347
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
348+
- name: Runner image version
349+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
344350
- name: Restore config.cache
345-
uses: actions/cache@v3
351+
uses: actions/cache@v4
346352
with:
347353
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
348-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
354+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
349355
- name: Configure CPython out-of-tree
350356
working-directory: ${{ env.CPYTHON_BUILDDIR }}
351357
run: |
@@ -375,7 +381,7 @@ jobs:
375381
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -r ${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt
376382
- name: 'Restore Hypothesis database'
377383
id: cache-hypothesis-database
378-
uses: actions/cache@v3
384+
uses: actions/cache@v4
379385
with:
380386
path: ./hypothesis
381387
key: hypothesis-database-${{ github.head_ref || github.run_id }}
@@ -415,16 +421,18 @@ jobs:
415421
needs: check_source
416422
if: needs.check_source.outputs.run_tests == 'true'
417423
env:
418-
OPENSSL_VER: 3.0.11
424+
OPENSSL_VER: 3.0.13
419425
PYTHONSTRICTEXTENSIONBUILD: 1
420426
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
421427
steps:
422428
- uses: actions/checkout@v4
429+
- name: Runner image version
430+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
423431
- name: Restore config.cache
424-
uses: actions/cache@v3
432+
uses: actions/cache@v4
425433
with:
426434
path: config.cache
427-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
435+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
428436
- name: Register gcc problem matcher
429437
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
430438
- name: Install Dependencies
@@ -440,7 +448,7 @@ jobs:
440448
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
441449
- name: 'Restore OpenSSL build'
442450
id: cache-openssl
443-
uses: actions/cache@v3
451+
uses: actions/cache@v4
444452
with:
445453
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
446454
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}

.github/workflows/jit.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on:
44
paths:
55
- '**jit**'
66
- 'Python/bytecodes.c'
7+
- 'Python/optimizer*.c'
8+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
79
push:
810
paths:
911
- '**jit**'
1012
- 'Python/bytecodes.c'
13+
- 'Python/optimizer*.c'
14+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
1115
workflow_dispatch:
1216

1317
concurrency:
@@ -18,6 +22,7 @@ jobs:
1822
jit:
1923
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
2024
runs-on: ${{ matrix.runner }}
25+
timeout-minutes: 60
2126
strategy:
2227
fail-fast: false
2328
matrix:

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
timeout-minutes: 60
9090
steps:
9191
- uses: actions/checkout@v4
92-
- uses: actions/cache@v3
92+
- uses: actions/cache@v4
9393
with:
9494
path: ~/.cache/pip
9595
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}

.github/workflows/reusable-macos.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
steps:
3030
- uses: actions/checkout@v4
31+
- name: Runner image version
32+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
3133
- name: Restore config.cache
32-
uses: actions/cache@v3
34+
uses: actions/cache@v4
3335
with:
3436
path: config.cache
35-
key: ${{ github.job }}-${{ matrix.os }}-${{ inputs.config_hash }}
37+
key: ${{ github.job }}-${{ matrix.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
3638
- name: Install Homebrew dependencies
3739
run: brew install pkg-config [email protected] xz gdbm tcl-tk
3840
- name: Configure CPython

.github/workflows/reusable-ubuntu.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
timeout-minutes: 60
1515
runs-on: ubuntu-20.04
1616
env:
17-
OPENSSL_VER: 3.0.11
17+
OPENSSL_VER: 3.0.13
1818
PYTHONSTRICTEXTENSIONBUILD: 1
1919
steps:
2020
- uses: actions/checkout@v4
@@ -29,7 +29,7 @@ jobs:
2929
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
3030
- name: 'Restore OpenSSL build'
3131
id: cache-openssl
32-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3333
with:
3434
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
3535
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -52,11 +52,13 @@ jobs:
5252
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
5353
- name: Bind mount sources read-only
5454
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
55+
- name: Runner image version
56+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
5557
- name: Restore config.cache
56-
uses: actions/cache@v3
58+
uses: actions/cache@v4
5759
with:
5860
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
59-
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
61+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
6062
- name: Configure CPython out-of-tree
6163
working-directory: ${{ env.CPYTHON_BUILDDIR }}
6264
run: ${{ inputs.options }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.7
3+
rev: v0.2.0
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/

Doc/c-api/buffer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ without intermediate copying.
2929
Python provides such a facility at the C level in the form of the :ref:`buffer
3030
protocol <bufferobjects>`. This protocol has two sides:
3131

32-
.. index:: single: PyBufferProcs
32+
.. index:: single: PyBufferProcs (C type)
3333

3434
- on the producer side, a type can export a "buffer interface" which allows
3535
objects of that type to expose information about their underlying buffer.

Doc/c-api/code.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ bound into a function.
2222
.. c:var:: PyTypeObject PyCode_Type
2323
2424
This is an instance of :c:type:`PyTypeObject` representing the Python
25-
:class:`code` type.
25+
:ref:`code object <code-objects>`.
2626

2727

2828
.. c:function:: int PyCode_Check(PyObject *co)
2929
30-
Return true if *co* is a :class:`code` object. This function always succeeds.
30+
Return true if *co* is a :ref:`code object <code-objects>`.
31+
This function always succeeds.
3132
3233
.. c:function:: int PyCode_GetNumFree(PyCodeObject *co)
3334
@@ -48,7 +49,7 @@ bound into a function.
4849
.. versionchanged:: 3.11
4950
Added ``qualname`` and ``exceptiontable`` parameters.
5051
51-
.. index:: single: PyCode_New
52+
.. index:: single: PyCode_New (C function)
5253
5354
.. versionchanged:: 3.12
5455
@@ -61,7 +62,7 @@ bound into a function.
6162
Similar to :c:func:`PyUnstable_Code_New`, but with an extra "posonlyargcount" for positional-only arguments.
6263
The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function.
6364
64-
.. index:: single: PyCode_NewWithPosOnlyArgs
65+
.. index:: single: PyCode_NewWithPosOnlyArgs (C function)
6566
6667
.. versionadded:: 3.8 as ``PyCode_NewWithPosOnlyArgs``
6768
@@ -220,7 +221,7 @@ may change without deprecation warnings.
220221
*free* will be called on non-``NULL`` data stored under the new index.
221222
Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`.
222223
223-
.. index:: single: _PyEval_RequestCodeExtraIndex
224+
.. index:: single: _PyEval_RequestCodeExtraIndex (C function)
224225
225226
.. versionadded:: 3.6 as ``_PyEval_RequestCodeExtraIndex``
226227
@@ -238,7 +239,7 @@ may change without deprecation warnings.
238239
If no data was set under the index, set *extra* to ``NULL`` and return
239240
0 without setting an exception.
240241
241-
.. index:: single: _PyCode_GetExtra
242+
.. index:: single: _PyCode_GetExtra (C function)
242243
243244
.. versionadded:: 3.6 as ``_PyCode_GetExtra``
244245
@@ -253,7 +254,7 @@ may change without deprecation warnings.
253254
Set the extra data stored under the given index to *extra*.
254255
Return 0 on success. Set an exception and return -1 on failure.
255256
256-
.. index:: single: _PyCode_SetExtra
257+
.. index:: single: _PyCode_SetExtra (C function)
257258
258259
.. versionadded:: 3.6 as ``_PyCode_SetExtra``
259260

Doc/c-api/dict.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,26 @@ Dictionary Objects
174174
.. versionadded:: 3.4
175175
176176
177+
.. c:function:: int PyDict_SetDefaultRef(PyObject *p, PyObject *key, PyObject *default_value, PyObject **result)
178+
179+
Inserts *default_value* into the dictionary *p* with a key of *key* if the
180+
key is not already present in the dictionary. If *result* is not ``NULL``,
181+
then *\*result* is set to a :term:`strong reference` to either
182+
*default_value*, if the key was not present, or the existing value, if *key*
183+
was already present in the dictionary.
184+
Returns ``1`` if the key was present and *default_value* was not inserted,
185+
or ``0`` if the key was not present and *default_value* was inserted.
186+
On failure, returns ``-1``, sets an exception, and sets ``*result``
187+
to ``NULL``.
188+
189+
For clarity: if you have a strong reference to *default_value* before
190+
calling this function, then after it returns, you hold a strong reference
191+
to both *default_value* and *\*result* (if it's not ``NULL``).
192+
These may refer to the same object: in that case you hold two separate
193+
references to it.
194+
.. versionadded:: 3.13
195+
196+
177197
.. c:function:: int PyDict_Pop(PyObject *p, PyObject *key, PyObject **result)
178198
179199
Remove *key* from dictionary *p* and optionally return the removed value.

0 commit comments

Comments
 (0)