aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/ast_unparse.c
Commit message (Collapse)AuthorAge
* gh-113993: Allow interned strings to be mortal, and fix related issues ↵Petr Viktorin2024-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-120520) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. * Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
* gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#119619)Sergey B Kirpichev2024-05-29
|
* gh-100227: Move _str_replace_inf to PyInterpreterState (gh-102333)Eric Snow2023-02-28
| | | https://github.com/python/cpython/issues/100227
* gh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487)Eric Snow2022-11-14
| | | | | This moves nearly all remaining object-holding globals in core code (other than static types). https://github.com/python/cpython/issues/81057
* bpo-43224: Implement PEP 646 grammar changes (GH-31018)Matthew Rahtz2022-03-26
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-22
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-28
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)Victor Stinner2021-03-23
| | | | | | | | | | | | | | | | These functions were undocumented and excluded from the limited C API. Most names defined by these header files were not prefixed by "Py" and so could create names conflicts. For example, Python-ast.h defined a "Yield" macro which was conflict with the "Yield" name used by the Windows <winbase.h> header. Use the Python ast module instead. * Move Include/asdl.h to Include/internal/pycore_asdl.h. * Move Include/Python-ast.h to Include/internal/pycore_ast.h. * Remove ast.h header file. * pycore_symtable.h no longer includes Python-ast.h.
* bpo-41746: Add type information to asdl_seq objects (GH-22223)Pablo Galindo2020-09-16
| | | | | | | | | | | | | * Add new capability to the PEG parser to type variable assignments. For instance: ``` | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a } ``` * Add new sequence types from the asdl definition (automatically generated) * Make `asdl_seq` type a generic aliasing pointer type. * Create a new `asdl_generic_seq` for the generic case using `void*`. * The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed. * New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences. * Changes all possible `asdl_seq` types to use specific versions everywhere.
* bpo-40663: Correctly handle annotations with subscripts in ast_unparse.c ↵Batuhan Taskaya2020-05-18
| | | | (GH-20156)
* Add spaces around the ":=" operator in ast_unparse.c (GH-19568)Hakan Çelik2020-04-18
|
* bpo-39522: Use _PyUnicodeWriter_WriteStr instead of PyUnicode_AS_DATA (GH-19523)Batuhan Taşkaya2020-04-14
|
* bpo-395222: Correctly unparse unicode prefix in ast_unparse.c (GH-19512)Batuhan Taşkaya2020-04-14
|
* bpo-32894: Support unparsing of infinity numbers in ast_unparser.c (GH-17426)Batuhan Taşkaya2020-04-14
|
* bpo-34822: Simplify AST for subscription. (GH-9605)Serhiy Storchaka2020-03-10
| | | | | | | | | * Remove the slice type. * Make Slice a kind of the expr type instead of the slice type. * Replace ExtSlice(slices) with Tuple(slices, Load()). * Replace Index(value) with a value itself. All non-terminal nodes in AST for expressions are now of the expr type.
* closes bpo-39898: Remove unused arg from append_formattedvalue. (GH-18840)Andy Lester2020-03-08
|
* bpo-39520: Fix un-parsing of ext slices with no dimensions (GH-18304)Batuhan Taşkaya2020-03-01
|
* bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node ↵Eric V. Smith2019-05-27
| | | | | instead (GH-13597) When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.
* bpo-36961: Handle positional-only arguments in uparse.c (GH-13412)Pablo Galindo2019-05-18
|
* Add support for PEP572 in ast_unparse.c (GH-13337)Batuhan Taşkaya2019-05-18
|
* bpo-36817: Add f-string debugging using '='. (GH-13123)Eric V. Smith2019-05-08
| | | If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
* bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)Serhiy Storchaka2018-09-30
| | | | | | | | | | * Compiling a string annotation containing a lambda with keyword-only argument without default value caused a crash. * Remove the final "*" (it is incorrect syntax) in the representation of lambda without *args and keyword-only arguments when compile from AST. * Improve the representation of lambda without arguments.
* bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)Serhiy Storchaka2018-09-27
|
* bpo-33475: Fix and improve converting annotations to strings. (GH-6774)Serhiy Storchaka2018-05-16
|
* bpo-32711: Fix warnings for Python/ast_unparse.c (#5426)Stéphane Wirtel2018-02-01
| | | * bpo-32711: Fix warnings for Python/ast_unparse.c
* String annotations [PEP 563] (#4390)Guido van Rossum2018-01-26
* Document `from __future__ import annotations` * Provide plumbing and tests for `from __future__ import annotations` * Implement unparsing the AST back to string form This is required for PEP 563 and as such only implements a part of the unparsing process that covers expressions.