summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* gh-131421: Fix ASDL tests (#133408)Jelle Zijlstra2025-05-041-8/+12
| | | | PR #131419 broke this, but we failed to run tests on the PR due to a bug in our script.
* gh-131421: fix ASDL grammar for `Dict` to have an `expr?*` keys field (#131419)Samuel2025-05-042-28/+38
| | | | | | | | | | | | | In the `ast` documentation for Python: * https://docs.python.org/3/library/ast.html#ast.Dict it is made clear that: > When doing dictionary unpacking using dictionary literals the expression to be expanded goes in the values list, with a `None` at the corresponding position in `keys`. Hence, `keys` is really a `expr?*` and *not* a `expr*`. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-133194: Fix regression with PEP 758 parsing on older `feature_version` ↵sobolevn2025-05-031-215/+304
| | | | | (#133289) gh-133192: Fix regression with PEP 758 parsing on older `feature_version`
* gh-133197: Improve error message for incompatible string / bytes prefixes ↵sobolevn2025-05-021-17/+56
| | | | (#133242)
* gh-123539: Improve SyntaxError msg for `import as` with not a name (#123629)sobolevn2025-05-021-725/+990
|
* gh-133196: Guard PEP 750 grammar with `CHECK_VERSION` (#133225)sobolevn2025-05-011-1/+1
|
* gh-133197: Improve error message for `ft""` and `bt""` cases (#133202)sobolevn2025-04-301-3/+17
|
* gh-133194: Add `CHECK_VERSION` to new PEP758 grammar (#133195)sobolevn2025-04-301-2/+2
|
* gh-132661: Implement PEP 750 (#132662)Lysandros Nikolaou2025-04-3013-1838/+3202
| | | | | | | | | | | | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Wingy <git@wingysam.xyz> Co-authored-by: Koudai Aono <koxudaxi@gmail.com> Co-authored-by: Dave Peck <davepeck@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Paul Everitt <pauleveritt@me.com> Co-authored-by: sobolevn <mail@sobolevn.me>
* gh-129858: Special syntax error for `elif` block after `else` (#129902)Steele Farnsworth2025-04-251-75/+108
|
* gh-132449: Improve syntax error messages for keywords with typos (#132450)Pablo Galindo Salgado2025-04-224-435/+566
| | | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-132769: Refactor possible read-out-of-bounds in `lexer.c` (#132770)sobolevn2025-04-211-1/+1
|
* gh-129958: Properly disallow newlines in format specs in single-quoted ↵Pablo Galindo Salgado2025-04-181-0/+8
| | | | f-strings (GH-130063)
* GH-131296: fix clang-cl warning on Windows in pegen.h (#131584)Chris Eibl2025-04-151-1/+1
|
* gh-131831: Implement PEP 758 – Allow except and except* expressions ↵Pablo Galindo Salgado2025-04-011-224/+323
| | | | without parentheses (#131833)
* gh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)Victor Stinner2025-03-271-2/+5
| | | | For example, expression_rule() return type is 'expr_ty', whereas _PyPegen_lookahead() uses 'void*'.
* gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a ↵rialbat2025-03-261-1/+1
| | | | NULL value (#131764)
* gh-131238: Remove includes from pycore_interp.h (#131495)Victor Stinner2025-03-201-0/+1
| | | Remove also now unused includes in C files.
* gh-131238: Remove pycore_lock.h includes (#131483)Victor Stinner2025-03-191-1/+1
| | | | PyMutex type is now part of <Python.h>, it's no longer needed to include <pycore_lock.h> to get it.
* gh-131238: Remove pycore_runtime.h from pycore_pystate.h (#131356)Victor Stinner2025-03-192-5/+5
| | | | | | | | | | | | * Remove includes from pycore_pystate.h: * pycore_runtime_structs.h * pycore_runtime.h * pycore_tstate.h * pycore_interp.h * Reorganize internal headers. Move _gc_thread_state from pycore_interp_structs.h to pycore_tstate.h. * Add 3 new header files to PCbuild/pythoncore.vcxproj.
* GH-131238: More refactoring of core header files (GH-131351)Mark Shannon2025-03-171-1/+1
| | | | Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
* gh-131238: Add explicit includes to pycore headers (#131257)Victor Stinner2025-03-173-11/+17
|
* GH-131238: Core header refactor (GH-131250)Mark Shannon2025-03-171-0/+3
| | | | | * Moves most structs in pycore_ header files into pycore_structs.h and pycore_runtime_structs.h * Removes many cross-header dependencies
* gh-130790: Remove references about unicode's readiness from comments (#130801)Sergey Miryanov2025-03-032-5/+1
|
* gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)Hugo Beauzée-Luyssen2025-03-021-2/+2
| | | | | Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not included first and when we are in a platform-agnostic context. This is to avoid having features defined by `stdbool.h` before those decided by `Python.h`.
* gh-130618: Fix parser error when using lambdas inside f-strings (#130638)Pablo Galindo Salgado2025-02-271-1/+5
|
* GH-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-252-484/+457
| | | | | | | | | | | * Implement C recursion protection with limit pointers for Linux, MacOS and Windows * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not ↵Petr Viktorin2025-02-242-457/+484
| | | | | | | | | counters. (GH-130007)" for now (GH130413) Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
* GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-192-484/+457
| | | | | | | | | | | | * Implement C recursion protection with limit pointers * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* gh-129515: Clarify syntax error messages for conditional expressions (#129880)Sergey Miryanov2025-02-181-1253/+1557
| | | | | Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-130139: always check ast node type in ast.parse() with ast input (#130140)Irit Katriel2025-02-161-11/+24
|
* gh-125331: Allow the parser to activate future imports on the fly (#125482)Pablo Galindo Salgado2025-02-143-1/+18
|
* gh-88535: Improve syntax error for wrongly closed strings (#26633)Pablo Galindo Salgado2025-02-131-609/+756
|
* gh-116042: Fix location for SyntaxErrors of invalid escapes in the tokenizer ↵Pablo Galindo Salgado2025-02-132-8/+46
| | | | (#116049)
* gh-128911: Add PyImport_ImportModuleAttr() function (#128912)Victor Stinner2025-01-302-2/+2
| | | | | | | | | | | Add PyImport_ImportModuleAttr() and PyImport_ImportModuleAttrString() functions. * Add unit tests. * Replace _PyImport_GetModuleAttr() with PyImport_ImportModuleAttr(). * Replace _PyImport_GetModuleAttrString() with PyImport_ImportModuleAttrString(). * Remove "pycore_import.h" includes, no longer needed.
* gh-119182: Use public PyUnicodeWriter in Python-ast.c (#129209)Victor Stinner2025-01-231-35/+39
| | | | | | Replace the private _PyUnicodeWriter API with the public PyUnicodeWriter API. Use PyUnicodeWriter_WriteRepr() in ast_repr_list().
* gh-124363: Treat debug expressions in f-string as raw strings (#128399)Pablo Galindo Salgado2025-01-221-43/+36
| | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-129093: Fix f-string debug text sometimes getting cut off when expression ↵Tomas R.2025-01-221-3/+1
| | | | contains `!` (#129159)
* gh-128016: Improved invalid escape sequence warning message (#128020)Umar Butler2025-01-152-8/+28
|
* gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473)qqwqqw6892025-01-011-5/+1
|
* gh-126240: handle `NULL` returned by `_Py_asdl_expr_seq_new` (#126241)Bénédikt Tran2024-10-311-0/+9
| | | check return value of `_Py_asdl_expr_seq_new`
* gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#126115)sobolevn2024-10-291-10/+8
| | | | Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
* gh-125196: Use PyUnicodeWriter in parser (#125271)Victor Stinner2024-10-121-7/+8
| | | | Replace the private _PyUnicodeWriter API with the public PyUnicodeWriter API in _PyPegen_concatenate_strings().
* gh-125268: Use static string for "1e309" in AST (#125272)Sam Gross2024-10-101-2/+0
| | | | | When formatting the AST as a string, infinite values are replaced by 1e309, which evaluates to infinity. The initialization of this string replacement was not thread-safe in the free threading build.
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)Victor Stinner2024-10-091-2/+2
| | | | | Replace PyUnicode_New(0, 0), PyUnicode_FromString("") and PyUnicode_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) (#125195)Victor Stinner2024-10-091-1/+1
| | | | Replace PyBytes_FromString("") and PyBytes_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).
* gh-125010: Fix `use-after-free` in AST `repr()` (#125015)Tomas R.2024-10-061-1/+0
|
* gh-122951: Simplify the grammar of the assignment rule (#124998)Rigel Di Scala2024-10-061-1584/+1525
|
* gh-111178: Fix function signatures in Python-ast.c (#124942)Victor Stinner2024-10-041-7/+11
|
* gh-124889: Remove redundant artificial rules in PEG parser (#124893)efimov-mikhail2024-10-031-8512/+1671
| | | | | | | | | | | | Cache in C PEG-generator reworked: we save artificial rules in cache by Node string representation as a key instead of Node object itself. As a result total count of artificial rules in parsers.c is lowered from 283 to 170. More natural number ordering is used for the names of artificial rules. Auxiliary method CCallMakerVisitor._generate_artificial_rule_call is added. Its purpose is abstracting work with artificial rules cache. Explicit using of "is_repeat1" kwarg is added to visit_Repeat0 and visit_Repeat1 methods. Its slightly improve code readabitily.