Skip to content

Commit 9694295

Browse files
authored
Merge branch 'main' into resourcetracker-status
2 parents 72c05ac + 7f074a7 commit 9694295

File tree

130 files changed

+3257
-2661
lines changed

Some content is hidden

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

130 files changed

+3257
-2661
lines changed

.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: 12 additions & 4 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
@@ -258,11 +260,13 @@ jobs:
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
@@ -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: |
@@ -420,11 +426,13 @@ jobs:
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/jit.yml

Lines changed: 4 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:

.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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/structures.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,26 +187,26 @@ Implementing functions and methods
187187
PyObject *kwargs);
188188
189189
190-
.. c:type:: _PyCFunctionFast
190+
.. c:type:: PyCFunctionFast
191191
192192
Type of the functions used to implement Python callables in C
193193
with signature :c:macro:`METH_FASTCALL`.
194194
The function signature is::
195195
196-
PyObject *_PyCFunctionFast(PyObject *self,
197-
PyObject *const *args,
198-
Py_ssize_t nargs);
196+
PyObject *PyCFunctionFast(PyObject *self,
197+
PyObject *const *args,
198+
Py_ssize_t nargs);
199199
200-
.. c:type:: _PyCFunctionFastWithKeywords
200+
.. c:type:: PyCFunctionFastWithKeywords
201201
202202
Type of the functions used to implement Python callables in C
203203
with signature :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-METH_KEYWORDS>`.
204204
The function signature is::
205205
206-
PyObject *_PyCFunctionFastWithKeywords(PyObject *self,
207-
PyObject *const *args,
208-
Py_ssize_t nargs,
209-
PyObject *kwnames);
206+
PyObject *PyCFunctionFastWithKeywords(PyObject *self,
207+
PyObject *const *args,
208+
Py_ssize_t nargs,
209+
PyObject *kwnames);
210210
211211
.. c:type:: PyCMethod
212212
@@ -290,7 +290,7 @@ There are these calling conventions:
290290
.. c:macro:: METH_FASTCALL
291291
292292
Fast calling convention supporting only positional arguments.
293-
The methods have the type :c:type:`_PyCFunctionFast`.
293+
The methods have the type :c:type:`PyCFunctionFast`.
294294
The first parameter is *self*, the second parameter is a C array
295295
of :c:expr:`PyObject*` values indicating the arguments and the third
296296
parameter is the number of arguments (the length of the array).
@@ -306,7 +306,7 @@ There are these calling conventions:
306306
307307
:c:expr:`METH_FASTCALL | METH_KEYWORDS`
308308
Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments,
309-
with methods of type :c:type:`_PyCFunctionFastWithKeywords`.
309+
with methods of type :c:type:`PyCFunctionFastWithKeywords`.
310310
Keyword arguments are passed the same way as in the
311311
:ref:`vectorcall protocol <vectorcall>`:
312312
there is an additional fourth :c:expr:`PyObject*` parameter

Doc/c-api/unicode.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,12 @@ wchar_t Support
854854
Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. At most
855855
*size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
856856
null termination character). Return the number of :c:type:`wchar_t` characters
857-
copied or ``-1`` in case of an error. Note that the resulting :c:expr:`wchar_t*`
857+
copied or ``-1`` in case of an error.
858+
859+
When *wstr* is ``NULL``, instead return the *size* that would be required
860+
to store all of *unicode* including a terminating null.
861+
862+
Note that the resulting :c:expr:`wchar_t*`
858863
string may or may not be null-terminated. It is the responsibility of the caller
859864
to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
860865
required by the application. Also, note that the :c:expr:`wchar_t*` string

Doc/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666

6767
rst_epilog = f"""
6868
.. |python_version_literal| replace:: ``Python {version}``
69+
.. |python_x_dot_y_literal| replace:: ``python{version}``
70+
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``
6971
"""
7072

7173
# There are two options for replacing |today|: either, you set today to some

Doc/data/stable_abi.dat

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ Other constructor:
18111811
be truncated).
18121812
4. Fractional hours and minutes are not supported.
18131813

1814-
Examples::
1814+
Examples:
18151815

18161816
.. doctest::
18171817

Doc/library/dbm.rst

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88

99
--------------
1010

11-
:mod:`dbm` is a generic interface to variants of the DBM database ---
12-
:mod:`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the
11+
:mod:`dbm` is a generic interface to variants of the DBM database:
12+
13+
* :mod:`dbm.sqlite3`
14+
* :mod:`dbm.gnu`
15+
* :mod:`dbm.ndbm`
16+
17+
If none of these modules are installed, the
1318
slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There
1419
is a `third party interface <https://www.jcea.es/programacion/pybsddb.htm>`_ to
1520
the Oracle Berkeley DB.
@@ -25,8 +30,8 @@ the Oracle Berkeley DB.
2530
.. function:: whichdb(filename)
2631

2732
This function attempts to guess which of the several simple database modules
28-
available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should
29-
be used to open a given file.
33+
available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`,
34+
or :mod:`dbm.dumb` --- should be used to open a given file.
3035

3136
Return one of the following values:
3237

@@ -56,10 +61,6 @@ the Oracle Berkeley DB.
5661
The Unix file access mode of the file (default: octal ``0o666``),
5762
used only when the database has to be created.
5863

59-
.. |incompat_note| replace::
60-
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
61-
and can not be used interchangeably.
62-
6364
.. function:: open(file, flag='r', mode=0o666)
6465

6566
Open a database and return the corresponding database object.
@@ -144,6 +145,46 @@ then prints out the contents of the database::
144145

145146
The individual submodules are described in the following sections.
146147

148+
:mod:`dbm.sqlite3` --- SQLite backend for dbm
149+
---------------------------------------------
150+
151+
.. module:: dbm.sqlite3
152+
:platform: All
153+
:synopsis: SQLite backend for dbm
154+
155+
.. versionadded:: 3.13
156+
157+
**Source code:** :source:`Lib/dbm/sqlite3.py`
158+
159+
--------------
160+
161+
This module uses the standard library :mod:`sqlite3` module to provide an
162+
SQLite backend for the :mod:`dbm` module.
163+
The files created by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`,
164+
or any other SQLite browser, including the SQLite CLI.
165+
166+
.. function:: open(filename, /, flag="r", mode=0o666)
167+
168+
Open an SQLite database.
169+
The returned object behaves like a :term:`mapping`,
170+
implements a :meth:`!close` method,
171+
and supports a "closing" context manager via the :keyword:`with` keyword.
172+
173+
:param filename:
174+
The path to the database to be opened.
175+
:type filename: :term:`path-like object`
176+
177+
:param str flag:
178+
179+
* ``'r'`` (default): |flag_r|
180+
* ``'w'``: |flag_w|
181+
* ``'c'``: |flag_c|
182+
* ``'n'``: |flag_n|
183+
184+
:param mode:
185+
The Unix file access mode of the file (default: octal ``0o666``),
186+
used only when the database has to be created.
187+
147188

148189
:mod:`dbm.gnu` --- GNU database manager
149190
---------------------------------------
@@ -160,11 +201,10 @@ The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU dbm)`
160201
library, similar to the :mod:`dbm.ndbm` module, but with additional
161202
functionality like crash tolerance.
162203

163-
:class:`!gdbm` objects behave similar to :term:`mappings <mapping>`,
164-
except that keys and values are always converted to :class:`bytes` before storing,
165-
and the :meth:`!items` and :meth:`!values` methods are not supported.
204+
.. note::
166205

167-
.. note:: |incompat_note|
206+
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
207+
and can not be used interchangeably.
168208

169209
.. exception:: error
170210

@@ -211,8 +251,9 @@ and the :meth:`!items` and :meth:`!values` methods are not supported.
211251

212252
A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` supports.
213253

214-
In addition to the dictionary-like methods, :class:`gdbm` objects have the
215-
following methods and attributes:
254+
:class:`!gdbm` objects behave similar to :term:`mappings <mapping>`,
255+
but :meth:`!items` and :meth:`!values` methods are not supported.
256+
The following methods are also provided:
216257

217258
.. method:: gdbm.firstkey()
218259

@@ -269,14 +310,13 @@ and the :meth:`!items` and :meth:`!values` methods are not supported.
269310

270311
The :mod:`dbm.ndbm` module provides an interface to the
271312
:abbr:`NDBM (New Database Manager)` library.
272-
:class:`!ndbm` objects behave similar to :term:`mappings <mapping>`,
273-
except that keys and values are always stored as :class:`bytes`,
274-
and the :meth:`!items` and :meth:`!values` methods are not supported.
275-
276313
This module can be used with the "classic" NDBM interface or the
277314
:abbr:`GDBM (GNU dbm)` compatibility interface.
278315

279-
.. note:: |incompat_note|
316+
.. note::
317+
318+
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
319+
and can not be used interchangeably.
280320

281321
.. warning::
282322

@@ -314,8 +354,9 @@ This module can be used with the "classic" NDBM interface or the
314354
:param int mode:
315355
|mode_param_doc|
316356

317-
In addition to the dictionary-like methods, :class:`!ndbm` objects
318-
provide the following method:
357+
:class:`!ndbm` objects behave similar to :term:`mappings <mapping>`,
358+
but :meth:`!items` and :meth:`!values` methods are not supported.
359+
The following methods are also provided:
319360

320361
.. versionchanged:: 3.11
321362
Accepts :term:`path-like object` for filename.
@@ -354,8 +395,6 @@ The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like
354395
interface which is written entirely in Python.
355396
Unlike other :mod:`dbm` backends, such as :mod:`dbm.gnu`, no
356397
external library is required.
357-
As with other :mod:`dbm` backends,
358-
the keys and values are always stored as :class:`bytes`.
359398

360399
The :mod:`!dbm.dumb` module defines the following:
361400

Doc/library/dis.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ iterations of the loop.
16061606

16071607
value = STACK.pop()
16081608
result = func(value)
1609-
STACK.push(result)
1609+
STACK.append(result)
16101610

16111611
* ``oparg == 1``: call :func:`str` on *value*
16121612
* ``oparg == 2``: call :func:`repr` on *value*
@@ -1623,7 +1623,7 @@ iterations of the loop.
16231623

16241624
value = STACK.pop()
16251625
result = value.__format__("")
1626-
STACK.push(result)
1626+
STACK.append(result)
16271627

16281628
Used for implementing formatted literal strings (f-strings).
16291629

@@ -1636,7 +1636,7 @@ iterations of the loop.
16361636
spec = STACK.pop()
16371637
value = STACK.pop()
16381638
result = value.__format__(spec)
1639-
STACK.push(result)
1639+
STACK.append(result)
16401640

16411641
Used for implementing formatted literal strings (f-strings).
16421642

@@ -1783,7 +1783,7 @@ iterations of the loop.
17831783
arg2 = STACK.pop()
17841784
arg1 = STACK.pop()
17851785
result = intrinsic2(arg1, arg2)
1786-
STACK.push(result)
1786+
STACK.append(result)
17871787

17881788
The operand determines which intrinsic function is called:
17891789

0 commit comments

Comments
 (0)