Skip to content

Commit d60946f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pegen-first-set-dispatch
2 parents cba604e + 2507a7f commit d60946f

102 files changed

Lines changed: 21232 additions & 17662 deletions

File tree

Some content is hidden

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

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Modules/_testinternalcapi/test_cases.c.h generated
102102
Modules/_testinternalcapi/test_targets.h generated
103103
PC/python3dll.c generated
104104
Parser/parser.c generated
105+
Parser/parser_invalid.c generated
105106
Parser/token.c generated
106107
Programs/test_frozenmain.h generated
107108
Python/Python-ast.c generated

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ Python/optimizer_symbols.c @markshannon @tomasr8 @Fidget-Spinner
302302

303303
# Parser, Lexer, and Grammar
304304
Grammar/python.gram @pablogsal @lysnikolaou
305+
Grammar/invalid.gram @pablogsal @lysnikolaou
305306
Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
306307
Lib/test/test_tokenize.py @pablogsal @lysnikolaou
307308
Lib/tokenize.py @pablogsal @lysnikolaou

‎.github/workflows/reusable-test-lazy-imports-all.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
- name: Verify excluded tests still need exclusion
6565
run: |
6666
set -euo pipefail
67+
# Failures are expected here, don't report them to the job summary
68+
unset GITHUB_STEP_SUMMARY
6769
unexpected_passes=()
6870
while IFS= read -r test_name; do
6971
[ -n "$test_name" ] || continue

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ are always available. They are listed here in alphabetical order.
354354
consists of a single expression, or ``'single'`` if it consists of a single
355355
interactive statement (in the latter case, expression statements that
356356
evaluate to something other than ``None`` will be printed).
357+
It can also be ``'func_type'`` if *source* consists of a
358+
function type signature, for example ``(int) -> str``; see
359+
:func:`ast.parse` for more information. This mode requires passing
360+
:data:`ast.PyCF_ONLY_AST` in *flags*.
357361

358362
The optional arguments *flags* and *dont_inherit* control which
359363
:ref:`compiler options <ast-compiler-flags>` should be activated
@@ -427,6 +431,9 @@ are always available. They are listed here in alphabetical order.
427431
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
428432
support for top-level ``await``, ``async for``, and ``async with``.
429433

434+
.. versionchanged:: 3.8
435+
Added support for ``mode='func_type'``.
436+
430437
.. versionchanged:: 3.12
431438
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
432439
are encountered in *source*.

‎Doc/deprecations/pending-removal-in-3.19.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Pending removal in Python 3.19
22
------------------------------
33

4+
* :mod:`builtins`:
5+
6+
* Passing a complex number as the *real* or *imag* argument in the
7+
:func:`complex` constructor is now deprecated; it should only be passed
8+
as a single positional argument.
9+
(Contributed by Serhiy Storchaka in :gh:`109218`.)
10+
411
* :mod:`ctypes`:
512

613
* Implicitly switching to the MSVC-compatible struct layout by setting

‎Doc/deprecations/pending-removal-in-future.rst‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ although there is currently no date scheduled for their removal.
3535
* Support for ``__complex__()`` method returning a strict subclass of
3636
:class:`complex`: these methods will be required to return an instance of
3737
:class:`complex`.
38-
* Passing a complex number as the *real* or *imag* argument in the
39-
:func:`complex` constructor is now deprecated; it should only be passed
40-
as a single positional argument.
41-
(Contributed by Serhiy Storchaka in :gh:`109218`.)
4238

4339
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
4440
deprecated and replaced by :data:`calendar.JANUARY` and

‎Doc/library/concurrent.futures.rst‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Executor Objects
130130
e.submit(shutil.copy, 'src4.txt', 'dest4.txt')
131131

132132
.. versionchanged:: 3.9
133-
Added *cancel_futures*.
133+
Added the *cancel_futures* parameter.
134134

135135

136136
ThreadPoolExecutor
@@ -172,7 +172,8 @@ And::
172172
# the single worker thread is already waiting for wait_on_future().
173173

174174

175-
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
175+
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', \
176+
initializer=None, initargs=(), **ctxkwargs)
176177
177178
An :class:`Executor` subclass that uses a pool of at most *max_workers*
178179
threads to execute calls asynchronously.
@@ -190,6 +191,18 @@ And::
190191
pending jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`,
191192
as well as any attempt to submit more jobs to the pool.
192193

194+
*ctxkwargs* is a mapping of additional keyword arguments passed to
195+
:meth:`prepare_context`, allowing customization of the worker execution
196+
context.
197+
198+
.. classmethod:: prepare_context(initializer, initargs)
199+
200+
Setting up the necessary context for creating worker instances in a
201+
pool-based executor (for example, in a concurrent environment like
202+
threads or interpreters).
203+
204+
.. versionadded:: 3.14
205+
193206
.. versionchanged:: 3.5
194207
If *max_workers* is ``None`` or
195208
not given, it will default to the number of processors on the machine,
@@ -219,6 +232,10 @@ And::
219232
Default value of *max_workers* is changed to
220233
``min(32, (os.process_cpu_count() or 1) + 4)``.
221234

235+
.. versionchanged:: 3.14
236+
Added *ctxkwargs* to pass additional arguments to :meth:`prepare_context`
237+
class method.
238+
222239

223240
.. _threadpoolexecutor-example:
224241

@@ -307,7 +324,8 @@ efficient alternative is to serialize with :mod:`pickle` and then send
307324
the bytes over a shared :mod:`socket <socket>` or
308325
:func:`pipe <os.pipe>`.
309326

310-
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
327+
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', \
328+
initializer=None, initargs=())
311329

312330
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
313331
using a pool of at most *max_workers* threads. Each thread runs
@@ -367,7 +385,9 @@ per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
367385
and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined
368386
in a REPL or a lambda should not be expected to work.
369387

370-
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
388+
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, \
389+
initializer=None, initargs=(), \
390+
max_tasks_per_child=None)
371391

372392
An :class:`Executor` subclass that executes calls asynchronously using a pool
373393
of at most *max_workers* processes. If *max_workers* is ``None`` or not

‎Doc/library/datetime.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,11 @@ where historical changes have been made to civil time.
24762476
Return ``dt + offset``. The *dt* argument must be an aware
24772477
:class:`.datetime` instance, with ``tzinfo`` set to ``self``.
24782478

2479+
.. attribute:: timezone.name
2480+
2481+
The *name* passed to the constructor, or ``None`` if no name was passed.
2482+
2483+
.. versionadded:: next
24792484

24802485
Class attributes:
24812486

‎Doc/library/json.rst‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Customizing JSON object decoding::
9999
>>> import decimal
100100
>>> json.loads('1.1', parse_float=decimal.Decimal)
101101
Decimal('1.1')
102+
>>> json.loads('{"name": "point", "coords": [[1, 2], [3, 4]]}',
103+
... array_hook=tuple) # doctest: +SKIP
104+
{'name': 'point', 'coords': ((1, 2), (3, 4))}
105+
>>> json.loads('{"name": "point", "coords": [1, 2]}',
106+
... object_pairs_hook=frozendict, array_hook=tuple) # doctest: +SKIP
107+
frozendict({'name': 'point', 'coords': (1, 2)})
102108

103109
Extending :class:`JSONEncoder`::
104110

@@ -304,7 +310,7 @@ Basic Usage
304310

305311
:param array_hook:
306312
If set, a function that is called with the result of
307-
any JSON array literal decoded with as a Python list.
313+
any JSON array literal decoded as a Python list.
308314
The return value of this function will be used
309315
instead of the :class:`list`.
310316
This feature can be used to implement custom decoders.

‎Doc/whatsnew/3.16.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ datetime
392392
:meth:`datetime.time.strptime`.
393393
(Contributed by Stan Ulbrych and Karoline Pauls in :gh:`157290`.)
394394

395+
* Add :attr:`datetime.timezone.name`, the *name* passed to the constructor,
396+
or ``None`` if no name was passed.
397+
(Contributed by Stan Ulbrych in :gh:`131210`.)
398+
395399

396400
dbm.gnu
397401
-------

0 commit comments

Comments
 (0)