Skip to content

Commit 1d00d9f

Browse files
committed
Merge branch 'main' into ft-thread-safe-deque
2 parents 3c10498 + d9f4cbe commit 1d00d9f

File tree

368 files changed

+14617
-6339
lines changed

Some content is hidden

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

368 files changed

+14617
-6339
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
@@ -94,6 +94,7 @@ Programs/test_frozenmain.h generated
9494
Python/Python-ast.c generated
9595
Python/executor_cases.c.h generated
9696
Python/generated_cases.c.h generated
97+
Python/tier2_redundancy_eliminator_bytecodes.c.h generated
9798
Python/opcode_targets.h generated
9899
Python/stdlib_module_names.h generated
99100
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: 15 additions & 7 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
135137
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
262266
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
@@ -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
@@ -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
345351
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: |
@@ -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
424432
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

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 1 deletion
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
3234
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: 4 additions & 2 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
@@ -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
5658
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 }}

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)