Skip to content

Commit 90981ee

Browse files
authored
Merge branch 'main' into pybyteswriter_encode_utf8
2 parents 65e90a6 + d641c41 commit 90981ee

File tree

150 files changed

+8395
-3694
lines changed

Some content is hidden

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

150 files changed

+8395
-3694
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,15 @@ Lib/test/test_dataclasses/ @ericvsmith
406406

407407
# Dates and times
408408
Doc/**/*time.rst @pganssle @abalkin
409+
Doc/library/zoneinfo.rst @pganssle
409410
Include/datetime.h @pganssle @abalkin
410411
Include/internal/pycore_time.h @pganssle @abalkin
412+
Lib/test/test_zoneinfo/ @pganssle
413+
Lib/zoneinfo/ @pganssle
411414
Lib/*time.py @pganssle @abalkin
412415
Lib/test/datetimetester.py @pganssle @abalkin
413416
Lib/test/test_*time.py @pganssle @abalkin
417+
Modules/*zoneinfo* @pganssle
414418
Modules/*time* @pganssle @abalkin
415419
Python/pytime.c @pganssle @abalkin
416420

.github/workflows/jit.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,33 @@ jobs:
134134
make all --jobs 4
135135
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
136136
137+
no-opt-jit:
138+
name: JIT without optimizations (Debug)
139+
needs: interpreter
140+
runs-on: ubuntu-24.04
141+
timeout-minutes: 90
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
llvm:
146+
- 19
147+
steps:
148+
- uses: actions/checkout@v4
149+
with:
150+
persist-credentials: false
151+
- uses: actions/setup-python@v5
152+
with:
153+
python-version: '3.11'
154+
- name: Build with JIT
155+
run: |
156+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
157+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
158+
./configure --enable-experimental-jit --with-pydebug
159+
make all --jobs 4
160+
- name: Run tests without optimizations
161+
run: |
162+
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
163+
137164
# XXX: GH-133171
138165
# jit-with-disabled-gil:
139166
# name: Free-Threaded (Debug)

Doc/c-api/init.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,10 @@ pointer and a void pointer argument.
18341834
called from the main interpreter. Each subinterpreter now has its own
18351835
list of scheduled calls.
18361836
1837+
.. versionchanged:: 3.12
1838+
This function now always schedules *func* to be run in the main
1839+
interpreter.
1840+
18371841
.. _profiling:
18381842
18391843
Profiling and Tracing

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ APIs:
747747
Return ``0`` on success, ``-1`` on error with an exception set.
748748
749749
This function checks that *unicode* is a Unicode object, that the index is
750-
not out of bounds, and that the object's reference count is one).
750+
not out of bounds, and that the object's reference count is one.
751751
See :c:func:`PyUnicode_WRITE` for a version that skips these checks,
752752
making them your responsibility.
753753

Doc/c-api/veryhigh.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ the same library that the Python runtime is using.
183183
objects *globals* and *locals* with the compiler flags specified by
184184
*flags*. *globals* must be a dictionary; *locals* can be any object
185185
that implements the mapping protocol. The parameter *start* specifies
186-
the start token that should be used to parse the source code.
186+
the start symbol and must one of the following:
187+
:c:data:`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`.
187188
188189
Returns the result of executing the code as a Python object, or ``NULL`` if an
189190
exception was raised.
@@ -231,7 +232,7 @@ the same library that the Python runtime is using.
231232
.. c:function:: PyObject* Py_CompileStringObject(const char *str, PyObject *filename, int start, PyCompilerFlags *flags, int optimize)
232233
233234
Parse and compile the Python source code in *str*, returning the resulting code
234-
object. The start token is given by *start*; this can be used to constrain the
235+
object. The start symbol is given by *start*; this can be used to constrain the
235236
code which can be compiled and should be :c:data:`Py_eval_input`,
236237
:c:data:`Py_file_input`, or :c:data:`Py_single_input`. The filename specified by
237238
*filename* is used to construct the code object and may appear in tracebacks or

Doc/deprecations/c-api-pending-removal-in-3.18.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Pending removal in Python 3.18
22
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33

4-
* Deprecated private functions (:gh:`128863`):
4+
* The following private functions are deprecated
5+
and planned for removal in Python 3.18:
56

67
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
78
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
8-
* :c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`.
9+
* :c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`.
910
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
1011
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
1112
use :c:func:`PyLongWriter_Create`.
@@ -31,7 +32,7 @@ Pending removal in Python 3.18
3132
:c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) <PyUnicodeWriter_WriteSubstring>`.
3233
* :c:func:`!_PyUnicodeWriter_WriteASCIIString`:
3334
replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with
34-
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
35+
:c:func:`PyUnicodeWriter_WriteASCII(writer, str) <PyUnicodeWriter_WriteASCII>`.
3536
* :c:func:`!_PyUnicodeWriter_WriteLatin1String`:
3637
replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with
3738
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
@@ -41,5 +42,6 @@ Pending removal in Python 3.18
4142
* :c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`.
4243

4344
The `pythoncapi-compat project
44-
<https://github.com/python/pythoncapi-compat/>`__ can be used to get these
45-
new public functions on Python 3.13 and older.
45+
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
46+
these new public functions on Python 3.13 and older.
47+
(Contributed by Victor Stinner in :gh:`128863`.)

Doc/library/argparse.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -774,16 +774,16 @@ how the command-line arguments should be handled. The supplied actions are:
774774
>>> parser.parse_args('--foo --bar'.split())
775775
Namespace(foo=True, bar=False, baz=True)
776776

777-
* ``'append'`` - This stores a list, and appends each argument value to the
778-
list. It is useful to allow an option to be specified multiple times.
779-
If the default value is non-empty, the default elements will be present
780-
in the parsed value for the option, with any values from the
781-
command line appended after those default values. Example usage::
777+
* ``'append'`` - This appends each argument value to a list.
778+
It is useful for allowing an option to be specified multiple times.
779+
If the default value is a non-empty list, the parsed value will start
780+
with the default list's elements and any values from the command line
781+
will be appended after those default values. Example usage::
782782

783783
>>> parser = argparse.ArgumentParser()
784-
>>> parser.add_argument('--foo', action='append')
784+
>>> parser.add_argument('--foo', action='append', default=['0'])
785785
>>> parser.parse_args('--foo 1 --foo 2'.split())
786-
Namespace(foo=['1', '2'])
786+
Namespace(foo=['0', '1', '2'])
787787

788788
* ``'append_const'`` - This stores a list, and appends the value specified by
789789
the const_ keyword argument to the list; note that the const_ keyword
@@ -981,8 +981,8 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
981981
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
982982
argument that can be followed by zero or one command-line arguments.
983983
When parsing the command line, if the option string is encountered with no
984-
command-line argument following it, the value of ``const`` will be assumed to
985-
be ``None`` instead. See the nargs_ description for examples.
984+
command-line argument following it, the value from ``const`` will be used.
985+
See the nargs_ description for examples.
986986

987987
.. versionchanged:: 3.11
988988
``const=None`` by default, including when ``action='append_const'`` or
@@ -1142,16 +1142,21 @@ if the argument was not one of the acceptable values::
11421142
game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
11431143
'paper', 'scissors')
11441144

1145-
Note that inclusion in the *choices* sequence is checked after any type_
1146-
conversions have been performed, so the type of the objects in the *choices*
1147-
sequence should match the type_ specified.
1148-
11491145
Any sequence can be passed as the *choices* value, so :class:`list` objects,
11501146
:class:`tuple` objects, and custom sequences are all supported.
11511147

11521148
Use of :class:`enum.Enum` is not recommended because it is difficult to
11531149
control its appearance in usage, help, and error messages.
11541150

1151+
Note that *choices* are checked after any type_
1152+
conversions have been performed, so objects in *choices*
1153+
should match the type_ specified. This can make *choices*
1154+
appear unfamiliar in usage, help, or error messages.
1155+
1156+
To keep *choices* user-friendly, consider a custom type wrapper that
1157+
converts and formats values, or omit type_ and handle conversion in
1158+
your application code.
1159+
11551160
Formatted choices override the default *metavar* which is normally derived
11561161
from *dest*. This is usually what you want because the user never sees the
11571162
*dest* parameter. If this display isn't desirable (perhaps because there are

Doc/library/html.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ This module defines utilities to manipulate HTML.
1414

1515
Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe
1616
sequences. Use this if you need to display text that might contain such
17-
characters in HTML. If the optional flag *quote* is true, the characters
18-
(``"``) and (``'``) are also translated; this helps for inclusion in an HTML
19-
attribute value delimited by quotes, as in ``<a href="...">``.
17+
characters in HTML. If the optional flag *quote* is true (the default), the
18+
characters (``"``) and (``'``) are also translated; this helps for inclusion
19+
in an HTML attribute value delimited by quotes, as in ``<a href="...">``.
20+
If *quote* is set to false, the characters (``"``) and (``'``) are not
21+
translated.
22+
2023

2124
.. versionadded:: 3.2
2225

Doc/library/inspect.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
253253
+-----------------+-------------------+---------------------------+
254254
| | gi_running | is the generator running? |
255255
+-----------------+-------------------+---------------------------+
256+
| | gi_suspended | is the generator |
257+
| | | suspended? |
258+
+-----------------+-------------------+---------------------------+
256259
| | gi_code | code |
257260
+-----------------+-------------------+---------------------------+
258261
| | gi_yieldfrom | object being iterated by |

Doc/library/os.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15011501

15021502
- :data:`RWF_HIPRI`
15031503
- :data:`RWF_NOWAIT`
1504+
- :data:`RWF_DONTCACHE`
15041505

15051506
Return the total number of bytes actually read which can be less than the
15061507
total capacity of all the objects.
@@ -1546,6 +1547,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15461547
.. versionadded:: 3.7
15471548

15481549

1550+
.. data:: RWF_DONTCACHE
1551+
1552+
Use uncached buffered IO.
1553+
1554+
.. availability:: Linux >= 6.14
1555+
1556+
.. versionadded:: next
1557+
1558+
15491559
.. function:: ptsname(fd, /)
15501560

15511561
Return the name of the slave pseudo-terminal device associated with the
@@ -1587,6 +1597,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15871597
- :data:`RWF_DSYNC`
15881598
- :data:`RWF_SYNC`
15891599
- :data:`RWF_APPEND`
1600+
- :data:`RWF_DONTCACHE`
15901601

15911602
Return the total number of bytes actually written.
15921603

0 commit comments

Comments
 (0)