Skip to content

Commit ed41bab

Browse files
committed
Merge branch 'main' into remove_setpythonhome
2 parents 251156b + 8293654 commit ed41bab

85 files changed

Lines changed: 1831 additions & 503 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.

‎.claude/CLAUDE.md‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎Doc/builtins/functions.rst‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,14 @@ are always available. They are listed here in alphabetical order.
384384
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
385385
by module name.
386386

387-
This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled
388-
source is invalid.
387+
This function raises :exc:`SyntaxError` if the compiled source is invalid,
388+
including a *source* containing a null character or that cannot be decoded;
389+
:exc:`ValueError` if *mode* or *flags* is invalid,
390+
or if a string *source* contains surrogate characters;
391+
:exc:`MemoryError` or :exc:`RecursionError` if *source* is too complex
392+
to parse or compile,
393+
for example an expression with many thousands of nested operators;
394+
and :exc:`OverflowError` if *source* is too large.
389395

390396
If you want to parse Python code into its AST representation, see
391397
:func:`ast.parse`.
@@ -417,11 +423,15 @@ are always available. They are listed here in alphabetical order.
417423
Previously, :exc:`TypeError` was raised when null bytes were encountered
418424
in *source*.
419425

420-
.. versionadded:: 3.8
426+
.. versionchanged:: 3.8
421427
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
422428
support for top-level ``await``, ``async for``, and ``async with``.
423429

424-
.. versionadded:: 3.15
430+
.. versionchanged:: 3.12
431+
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
432+
are encountered in *source*.
433+
434+
.. versionchanged:: 3.15
425435
Added the *module* parameter.
426436

427437

‎Doc/c-api/interp-lifecycle.rst‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ The following functions can be safely called before Python is initialized:
7272

7373
Despite their apparent similarity to some of the functions listed above,
7474
the following functions **should not be called** before the interpreter has
75-
been initialized: :c:func:`Py_EncodeLocale`, :c:func:`PyEval_InitThreads`, and
76-
:c:func:`Py_RunMain`.
75+
been initialized: :c:func:`Py_EncodeLocale`, and :c:func:`Py_RunMain`.
7776

7877

7978
.. _global-conf-vars:
@@ -353,7 +352,6 @@ Initializing and finalizing the interpreter
353352
.. c:function:: void Py_Initialize()
354353
355354
.. index::
356-
single: PyEval_InitThreads()
357355
single: modules (in module sys)
358356
single: path (in module sys)
359357
pair: module; builtins

‎Doc/c-api/threads.rst‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -577,33 +577,6 @@ C extensions.
577577
This thread's interpreter state.
578578
579579
580-
.. c:function:: void PyEval_InitThreads()
581-
582-
.. index::
583-
single: PyEval_AcquireThread()
584-
single: PyEval_ReleaseThread()
585-
single: PyEval_SaveThread()
586-
single: PyEval_RestoreThread()
587-
588-
Deprecated function which does nothing.
589-
590-
In Python 3.6 and older, this function created the GIL if it didn't exist.
591-
592-
.. versionchanged:: 3.9
593-
The function now does nothing.
594-
595-
.. versionchanged:: 3.7
596-
This function is now called by :c:func:`Py_Initialize()`, so you don't
597-
have to call it yourself anymore.
598-
599-
.. versionchanged:: 3.2
600-
This function cannot be called before :c:func:`Py_Initialize()` anymore.
601-
602-
.. deprecated:: 3.9
603-
604-
.. index:: pair: module; _thread
605-
606-
607580
.. c:function:: PyThreadState* PyEval_SaveThread()
608581
609582
Detach the :term:`attached thread state` and return it.

‎Doc/data/stable_abi.dat‎

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

‎Doc/library/code.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Interactive Interpreter Objects
9292
*symbol* is ``'single'``. One of several things can happen:
9393

9494
* The input is incorrect; :func:`compile_command` raised an exception
95-
(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be
95+
(usually :exc:`SyntaxError`). A syntax traceback will be
9696
printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource`
9797
returns ``False``.
9898

‎Doc/library/symtable.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ Examining Symbol Tables
5757

5858
Used for the symbol table of a class.
5959

60+
.. attribute:: INLINED_COMPREHENSION
61+
:value: "inlined comprehension"
62+
63+
Used for the symbol table of a list, set or dict comprehension that
64+
is inlined into the enclosing code unit (see :pep:`709`). A symbol
65+
table of this type represents a sub-scope of the enclosing code unit's
66+
scope, and it does not correspond to a separate compilation unit.
67+
68+
.. versionadded:: next
69+
6070
The following members refer to different flavors of
6171
:ref:`annotation scopes <annotation-scopes>`.
6272

‎Doc/tools/removed-ids.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ c-api/interp-lifecycle.html: c.PySys_SetArgv
77
c-api/interp-lifecycle.html: c.PySys_SetArgvEx
88
c-api/interp-lifecycle.html: c.Py_SetProgramName
99
c-api/interp-lifecycle.html: c.Py_SetPythonHome
10+
c-api/threads.html: c.PyEval_InitThreads
1011

1112
# Removed sections
1213
library/asyncio-task.html: terminating-a-task-group

‎Doc/whatsnew/3.16.rst‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,16 @@ symtable
573573
like the builtin :func:`compile`.
574574
(Contributed by Serhiy Storchaka in :gh:`153844`.)
575575

576+
* Inlined list, set and dict comprehensions (:pep:`709`) are now represented
577+
as their own symbol table entries, of type
578+
:attr:`~symtable.SymbolTableType.INLINED_COMPREHENSION`. Each such entry is
579+
a lexical child of the enclosing scope and records the comprehension's own
580+
locals, cells, and free names. It does not correspond to a separate
581+
compilation unit. For names loaded only inside an inlined list, set, or
582+
dict comprehension, :meth:`symtable.Symbol.is_referenced` can now return
583+
``True`` on the enclosing function.
584+
(Contributed by Irit Katriel in :gh:`124697`.)
585+
576586

577587
tkinter
578588
-------
@@ -1131,6 +1141,10 @@ Deprecated C APIs
11311141
Removed C APIs
11321142
--------------
11331143

1144+
* Remove :c:func:`!PyEval_InitThreads` function which did nothing since Python
1145+
3.7 and was deprecated since Python 3.9.
1146+
(Contributed by Victor Stinner in :gh:`154757`.)
1147+
11341148
* Remove :c:func:`!Py_SetProgramName` and :c:func:`!Py_SetPythonHome`
11351149
functions, deprecated since Python 3.11. Instead, use :ref:`PyInitConfig C
11361150
API <pyinitconfig_api>` to set respectively ``"program_name"`` and

‎Grammar/python.gram‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,12 @@ complex_number[expr_ty]:
555555

556556
signed_number[expr_ty]:
557557
| NUMBER
558-
| '+' number=NUMBER { number }
558+
| '+' number=NUMBER { _PyAST_UnaryOp(UAdd, number, EXTRA) }
559559
| '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }
560560

561561
signed_real_number[expr_ty]:
562562
| real_number
563-
| '+' real=real_number { real }
563+
| '+' real=real_number { _PyAST_UnaryOp(UAdd, real, EXTRA) }
564564
| '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }
565565

566566
real_number[expr_ty]:

0 commit comments

Comments
 (0)