Skip to content

Commit 395b392

Browse files
authored
Merge branch 'main' into tstring-annotationlib
2 parents 68dba76 + a9b6b09 commit 395b392

File tree

84 files changed

+3104
-1542
lines changed

Some content is hidden

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

84 files changed

+3104
-1542
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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Cross platform
5656
Returns the machine type, e.g. ``'AMD64'``. An empty string is returned if the
5757
value cannot be determined.
5858

59+
The output is platform-dependent and may differ in casing and naming conventions.
60+
5961

6062
.. function:: node()
6163

Doc/library/sqlite3.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ Connection objects
620620
supplied, this must be a :term:`callable` returning
621621
an instance of :class:`Cursor` or its subclasses.
622622

623-
.. method:: blobopen(table, column, row, /, *, readonly=False, name="main")
623+
.. method:: blobopen(table, column, rowid, /, *, readonly=False, name="main")
624624

625625
Open a :class:`Blob` handle to an existing
626626
:abbr:`BLOB (Binary Large OBject)`.
@@ -631,8 +631,8 @@ Connection objects
631631
:param str column:
632632
The name of the column where the blob is located.
633633

634-
:param str row:
635-
The name of the row where the blob is located.
634+
:param int rowid:
635+
The row id where the blob is located.
636636

637637
:param bool readonly:
638638
Set to ``True`` if the blob should be opened without write

Doc/library/warnings.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,20 @@ the disposition of the match. Each entry is a tuple of the form (*action*,
159159

160160
* *message* is a string containing a regular expression that the start of
161161
the warning message must match, case-insensitively. In :option:`-W` and
162-
:envvar:`PYTHONWARNINGS`, *message* is a literal string that the start of the
163-
warning message must contain (case-insensitively), ignoring any whitespace at
162+
:envvar:`PYTHONWARNINGS`, if *message* starts and ends with a forward slash
163+
(``/``), it specifies a regular expression as above;
164+
otherwise it is a literal string that the start of the
165+
warning message must match (case-insensitively), ignoring any whitespace at
164166
the start or end of *message*.
165167

166168
* *category* is a class (a subclass of :exc:`Warning`) of which the warning
167169
category must be a subclass in order to match.
168170

169171
* *module* is a string containing a regular expression that the start of the
170172
fully qualified module name must match, case-sensitively. In :option:`-W` and
171-
:envvar:`PYTHONWARNINGS`, *module* is a literal string that the
173+
:envvar:`PYTHONWARNINGS`, if *module* starts and ends with a forward slash
174+
(``/``), it specifies a regular expression as above;
175+
otherwise it is a literal string that the
172176
fully qualified module name must be equal to (case-sensitively), ignoring any
173177
whitespace at the start or end of *module*.
174178

Doc/using/cmdline.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,10 @@ Miscellaneous options
479479
The *action* field is as explained above but only applies to warnings that
480480
match the remaining fields.
481481

482-
The *message* field must match the whole warning message; this match is
483-
case-insensitive.
482+
The *message* field must match the start of the warning message;
483+
this match is case-insensitive.
484+
If it starts and ends with a forward slash (``/``), it specifies
485+
a regular expression, otherwise it specifies a literal string.
484486

485487
The *category* field matches the warning category
486488
(ex: ``DeprecationWarning``). This must be a class name; the match test
@@ -489,6 +491,10 @@ Miscellaneous options
489491

490492
The *module* field matches the (fully qualified) module name; this match is
491493
case-sensitive.
494+
If it starts and ends with a forward slash (``/``), it specifies
495+
a regular expression that the start of the fully qualified module name
496+
must match, otherwise it specifies a literal string that the fully
497+
qualified module name must be equal to.
492498

493499
The *lineno* field matches the line number, where zero matches all line
494500
numbers and is thus equivalent to an omitted line number.
@@ -506,6 +512,9 @@ Miscellaneous options
506512
See :ref:`warning-filter` and :ref:`describing-warning-filters` for more
507513
details.
508514

515+
.. versionchanged:: next
516+
Added regular expression support for *message* and *module*.
517+
509518

510519
.. option:: -x
511520

@@ -980,6 +989,9 @@ conflict.
980989
See :ref:`warning-filter` and :ref:`describing-warning-filters` for more
981990
details.
982991

992+
.. versionchanged:: next
993+
Added regular expression support for *message* and *module*.
994+
983995

984996
.. envvar:: PYTHONFAULTHANDLER
985997

0 commit comments

Comments
 (0)