| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -384,8 +384,14 @@ are always available. They are listed here in alphabetical order. | |||
| 384 | 384 | It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings | |
| 385 | 385 | by module name. | |
| 386 | 386 | ||
| 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. | ||
| 389 | 395 | ||
| 390 | 396 | If you want to parse Python code into its AST representation, see | |
| 391 | 397 | :func:`ast.parse`. | |
@@ -417,11 +423,15 @@ are always available. They are listed here in alphabetical order. | |||
| 417 | 423 | Previously, :exc:`TypeError` was raised when null bytes were encountered | |
| 418 | 424 | in *source*. | |
| 419 | 425 | ||
| 420 | - .. versionadded:: 3.8 | ||
| 426 | + .. versionchanged:: 3.8 | ||
| 421 | 427 | ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable | |
| 422 | 428 | support for top-level ``await``, ``async for``, and ``async with``. | |
| 423 | 429 | ||
| 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 | ||
| 425 | 435 | Added the *module* parameter. | |
| 426 | 436 | ||
| 427 | 437 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,8 +72,7 @@ The following functions can be safely called before Python is initialized: | |||
| 72 | 72 | ||
| 73 | 73 | Despite their apparent similarity to some of the functions listed above, | |
| 74 | 74 | 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`. | ||
| 77 | 76 | ||
| 78 | 77 | ||
| 79 | 78 | .. _global-conf-vars: | |
@@ -353,7 +352,6 @@ Initializing and finalizing the interpreter | |||
| 353 | 352 | .. c:function:: void Py_Initialize() | |
| 354 | 353 | ||
| 355 | 354 | .. index:: | |
| 356 | - single: PyEval_InitThreads() | ||
| 357 | 355 | single: modules (in module sys) | |
| 358 | 356 | single: path (in module sys) | |
| 359 | 357 | pair: module; builtins | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -577,33 +577,6 @@ C extensions. | |||
| 577 | 577 | This thread's interpreter state. | |
| 578 | 578 | ||
| 579 | 579 | ||
| 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 | - | ||
| 607 | 580 | .. c:function:: PyThreadState* PyEval_SaveThread() | |
| 608 | 581 | ||
| 609 | 582 | Detach the :term:`attached thread state` and return it. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,7 +92,7 @@ Interactive Interpreter Objects | |||
| 92 | 92 | *symbol* is ``'single'``. One of several things can happen: | |
| 93 | 93 | ||
| 94 | 94 | * 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 | ||
| 96 | 96 | printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` | |
| 97 | 97 | returns ``False``. | |
| 98 | 98 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,6 +57,16 @@ Examining Symbol Tables | |||
| 57 | 57 | ||
| 58 | 58 | Used for the symbol table of a class. | |
| 59 | 59 | ||
| 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 | + | ||
| 60 | 70 | The following members refer to different flavors of | |
| 61 | 71 | :ref:`annotation scopes <annotation-scopes>`. | |
| 62 | 72 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ c-api/interp-lifecycle.html: c.PySys_SetArgv | |||
| 7 | 7 | c-api/interp-lifecycle.html: c.PySys_SetArgvEx | |
| 8 | 8 | c-api/interp-lifecycle.html: c.Py_SetProgramName | |
| 9 | 9 | c-api/interp-lifecycle.html: c.Py_SetPythonHome | |
| 10 | + c-api/threads.html: c.PyEval_InitThreads | ||
| 10 | 11 | ||
| 11 | 12 | # Removed sections | |
| 12 | 13 | library/asyncio-task.html: terminating-a-task-group | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -573,6 +573,16 @@ symtable | |||
| 573 | 573 | like the builtin :func:`compile`. | |
| 574 | 574 | (Contributed by Serhiy Storchaka in :gh:`153844`.) | |
| 575 | 575 | ||
| 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 | + | ||
| 576 | 586 | ||
| 577 | 587 | tkinter | |
| 578 | 588 | ------- | |
@@ -1131,6 +1141,10 @@ Deprecated C APIs | |||
| 1131 | 1141 | Removed C APIs | |
| 1132 | 1142 | -------------- | |
| 1133 | 1143 | ||
| 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 | + | ||
| 1134 | 1148 | * Remove :c:func:`!Py_SetProgramName` and :c:func:`!Py_SetPythonHome` | |
| 1135 | 1149 | functions, deprecated since Python 3.11. Instead, use :ref:`PyInitConfig C | |
| 1136 | 1150 | API <pyinitconfig_api>` to set respectively ``"program_name"`` and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -555,12 +555,12 @@ complex_number[expr_ty]: | |||
| 555 | 555 | ||
| 556 | 556 | signed_number[expr_ty]: | |
| 557 | 557 | | NUMBER | |
| 558 | - | '+' number=NUMBER { number } | ||
| 558 | + | '+' number=NUMBER { _PyAST_UnaryOp(UAdd, number, EXTRA) } | ||
| 559 | 559 | | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) } | |
| 560 | 560 | ||
| 561 | 561 | signed_real_number[expr_ty]: | |
| 562 | 562 | | real_number | |
| 563 | - | '+' real=real_number { real } | ||
| 563 | + | '+' real=real_number { _PyAST_UnaryOp(UAdd, real, EXTRA) } | ||
| 564 | 564 | | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) } | |
| 565 | 565 | ||
| 566 | 566 | real_number[expr_ty]: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments