summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-120155: Fix Coverity issue in parse_string() (GH-120997) (#121005)Miss Islington (bot)2024-06-251-0/+5
| | | | | | gh-120155: Fix Coverity issue in parse_string() (GH-120997) (cherry picked from commit 769aea332940f03c3e5b1ad9badd6635c1ac992a) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-120108: Fix deepcopying of AST trees with .parent attributes ↵Jelle Zijlstra2024-06-251-17/+14
| | | | | (GH-120114) (#121000) (cherry picked from commit 42b2c9d78da7ebd6bd5925a4d4c78aec3c9e78e6)
* [3.13] gh-113993: Allow interned strings to be mortal, and fix related ↵Petr Viktorin2024-06-242-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues (GH-120520) (GH-120945) * 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>
* [3.13] gh-119521: Rename IncompleteInputError to _IncompleteInputError and ↵Miss Islington (bot)2024-06-241-0/+1
| | | | | | | | | | | | | remove from public API/ABI (GH-119680, GH-120955) (GH-120944) - gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680) (cherry picked from commit ce1064e4c9bcfd673323ad690e60f86e1ab907bb) - gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955) (cherry picked from commit ac61d58db0753a3b37de21dbc6e86b38f2a93f1b) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-119724: Revert "bpo-45759: Better error messages for non-matching ↵T. Wouters2024-06-041-547/+449
| | | | | | | | 'elif'/'else' statements (GH-29513)" (GH-119974) (GH-120013) This reverts commit 1c8f912ebdfdb146cd7dd2d7a3a67d2c5045ddb0. (cherry picked from commit 31a4fb3c74a0284436343858803b54471e2dc9c7)
* [3.13] gh-119118: Fix performance regression in tokenize module (GH-119615) ↵Miss Islington (bot)2024-05-282-0/+26
| | | | | | | | | | | | | (#119682) - Cache line object to avoid creating a Unicode object for all of the tokens in the same line. - Speed up byte offset to column offset conversion by using the smallest buffer possible to measure the difference. (cherry picked from commit d87b0151062e36e67f9e42e1595fba5bf23a485c) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* [3.13] gh-118851: Default ctx arguments to AST constructors to Load() ↵Miss Islington (bot)2024-05-091-0/+7
| | | | | | | | (GH-118854) (#118871) (cherry picked from commit 68fbc00dc870f6a8dcbecd2ec19298e21015867f) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-118090: Improve error message for empty type param brackets (GH-118091)Nikita Sobolev2024-05-071-797/+962
|
* gh-117486: Improve behavior for user-defined AST subclasses (#118212)Jelle Zijlstra2024-05-061-14/+17
| | | | | | | | Now, such classes will no longer require changes in Python 3.13 in the normal case. The test suite for robotframework passes with no DeprecationWarnings under this PR. I also added a new DeprecationWarning for the case where `_field_types` exists but is incomplete, since that seems likely to indicate a user mistake.
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+1
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-032-446/+551
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-116988: Remove duplicates of `annotated_rhs` in the Grammar (#117004)David Rubin2024-04-241-2091/+1560
|
* gh-118082: Improve `import` without names syntax error message (#118083)Nikita Sobolev2024-04-231-149/+200
|
* gh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444)Grigoriev Semyon2024-04-021-1230/+1417
|
* gh-117266: Fix crashes on user-created AST subclasses (GH-117276)Jelle Zijlstra2024-03-281-2/+13
| | | Fix crashes on user-created AST subclasses
* bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)Pablo Galindo Salgado2024-03-261-594/+970
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)Serhiy Storchaka2024-03-071-9/+9
|
* gh-105858: Improve AST node constructors (#105880)Jelle Zijlstra2024-02-281-7/+231
| | | | | | | | | | | | | | | | | Demonstration: >>> ast.FunctionDef.__annotations__ {'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]} >>> ast.FunctionDef() <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15. <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15. <ast.FunctionDef object at 0x101959460> >>> node = ast.FunctionDef(name="foo", args=ast.arguments()) >>> node.decorator_list [] >>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments()) <stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15. <ast.FunctionDef object at 0x1019581f0>
* gh-115823: Calculate correctly error locations when dealing with implicit ↵Pablo Galindo Salgado2024-02-261-11/+9
| | | | encodings (#115824)
* gh-115881: Ensure `ast.parse()` parses conditional context managers even ↵Alex Waygood2024-02-261-1/+1
| | | | with low `feature_version` passed (#115920)
* gh-113744: Add a new IncompleteInputError exception to improve incomplete ↵Pablo Galindo Salgado2024-01-301-1/+1
| | | | | input detection in the codeop module (#113745) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-114569: Use PyMem_* APIs for most non-PyObject uses (#114574)Erlend E. Aasland2024-01-261-2/+2
| | | Fix usage in Modules, Objects, and Parser subdirectories.
* GH-113655: Lower the C recursion limit on various platforms (GH-113944)Mark Shannon2024-01-161-3/+2
|
* gh-111488: Changed error message in case of no 'in' keyword after 'for' in ↵Grigoriev Semyon2024-01-061-1592/+1785
| | | | cmp (#113656)
* gh-113703: Correctly identify incomplete f-strings in the codeop module ↵Pablo Galindo Salgado2024-01-051-2/+6
| | | | (#113709)
* gh-113602: Bail out when the parser tries to override existing errors (#113607)Pablo Galindo Salgado2024-01-021-0/+4
| | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-106905: Use separate structs to track recursion depth in each ↵Yilei Yang2023-12-251-25/+28
| | | | | | PyAST_mod2obj call. (GH-113035) Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* gh-112943: Correctly compute end offsets for multiline tokens in the ↵Pablo Galindo Salgado2023-12-112-5/+12
| | | | tokenize module (#112949)
* Fix typos in variable names, function names, and comments (GH-101868)Yang Hau2023-12-011-1/+1
|
* gh-112387: Fix error positions for decoded strings with backwards tokenize ↵Pablo Galindo Salgado2023-11-271-0/+4
| | | | | errors (#112409) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-112388: Fix an error that was causing the parser to try to overwrite ↵Pablo Galindo Salgado2023-11-271-0/+4
| | | | | tokenizer errors (#112410) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-112243: Don't include comments in f-string debug expressions (#112284)Pablo Galindo Salgado2023-11-201-6/+49
|
* bpo-45759: Better error messages for non-matching 'elif'/'else' statements ↵Crowthebird2023-11-201-435/+533
| | | | (#29513)
* GH-111807: Lower the parser stack depth under WASI debug builds (#112225)Brett Cannon2023-11-201-1/+5
|
* gh-111956: Add thread-safe one-time initialization. (gh-111960)Sam Gross2023-11-161-47/+42
|
* gh-106905: avoid incorrect SystemError about recursion depth mismatch (#106906)Markus Mohrhard2023-11-131-0/+1
| | | | | | | | | | * gh-106905: avoid incorrect SystemError about recursion depth mismatch * Update Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst --------- Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Simplify _PyPegen_join_names_with_dot() (GH-111602)Serhiy Storchaka2023-11-011-32/+2
|
* gh-111420: Allow type comments in parenthesized `with` statements (#111468)Tomas R2023-10-311-6/+9
|
* gh-111380: Show SyntaxWarnings only once when parsing if invalid syntax is ↵Pablo Galindo Salgado2023-10-271-0/+5
| | | | encouintered (#111381)
* gh-100445: Improve error message for unterminated strings with escapes (#100446)Shantanu2023-10-181-2/+16
|
* gh-110938: Fix error messages for indented blocks with functions and classes ↵Pablo Galindo Salgado2023-10-171-19/+31
| | | | with generic type parameters (#110973)
* gh-107450: Remove unnecessary overflow check in parser error handler (#110940)Lysandros Nikolaou2023-10-161-6/+0
|
* gh-107450: Check for overflow in the tokenizer and fix overflow test (#110832)Lysandros Nikolaou2023-10-162-0/+9
| | | | Co-authored-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-110805: Allow the repl to show source code and complete tracebacks (#110775)Pablo Galindo Salgado2023-10-133-3/+27
|
* gh-107450: Raise OverflowError when parser column offset overflows (#110754)Lysandros Nikolaou2023-10-121-0/+6
|
* gh-110696: Fix incorrect syntax error message for incorrect argument ↵Pablo Galindo Salgado2023-10-121-1133/+1485
| | | | unpacking (#110706)
* gh-104169: Fix test_peg_generator after tokenizer refactoring (#110727)Lysandros Nikolaou2023-10-122-4/+5
| | | | * Fix test_peg_generator after tokenizer refactoring * Remove references to tokenizer.c in comments etc.
* GH-110749: fix unistd.h import in file_tokenizer.c (#110750)Filipe Laíns2023-10-121-4/+4
|
* gh-104169: Refactor tokenizer into lexer and wrappers (#110684)Lysandros Nikolaou2023-10-1119-2978/+3075
| | | | | | | | | | | * The lexer, which include the actual lexeme producing logic, goes into the `lexer` directory. * The wrappers, one wrapper per input mode (file, string, utf-8, and readline), go into the `tokenizer` directory and include logic for creating a lexer instance and managing the buffer for different modes. --------- Co-authored-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-110309: Prune empty constant in format specs (#110320)sunmy20192023-10-051-10/+30
| | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>