summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-109114: Relax the check for invalid lambdas inside f-strings to ↵Pablo Galindo Salgado2023-09-121-1124/+1065
| | | | | | | | avoid false positives (GH-109121). (#109155) (cherry picked from commit 5bda2f637e1cfbca45a83aa6e22db25498064b27) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-108179: Add error message for parser stack overflows (GH-108256) ↵Miss Islington (bot)2023-08-223-1060/+540
| | | | | | | | (#108263) gh-108179: Add error message for parser stack overflows (GH-108256) (cherry picked from commit 86617518c4ac824e2b6dc20691ba5a08df04f285) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* [3.12] gh-107967: Fix infinite recursion on invalid escape sequence warning ↵Miss Islington (bot)2023-08-151-0/+3
| | | | | | | | (GH-107968) (#107970) gh-107967: Fix infinite recursion on invalid escape sequence warning (GH-107968) (cherry picked from commit d66bc9e8a7a8d6774d912a4b9d151885c4d8de1d) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] GH-107263: Increase C stack limit for most functions, except ↵Miss Islington (bot)2023-08-041-1/+1
| | | | | | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) (#107618) GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2. (cherry picked from commit fa45958450aa3489607daf9855ca0474a2a20878) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] gh-106989: Remove tok report warnings (GH-106993) (#107013)Miss Islington (bot)2023-07-222-6/+0
| | | | Co-authored-by: Menelaos Kotoglou <contact@menelaoskotoglou.com>
* [3.12] gh-106396: Special-case empty format spec to gen empty JoinedStr node ↵Miss Islington (bot)2023-07-041-0/+12
| | | | | | | (GH-106401) (#106416) (cherry picked from commit dfe4de203881e8d068e6fc5b8e31075841a86d25) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] gh-106145: Make `end_{lineno,col_offset}` required on `type_param` ↵Miss Islington (bot)2023-07-011-1/+1
| | | | | | | | nodes (GH-106224) (#106295) gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (GH-106224) (cherry picked from commit 46c1097868745eeb47abbc8af8c34e8fcb80ff1d) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-98931: Add custom error messages to invalid import/from with ↵Miss Islington (bot)2023-06-221-596/+719
| | | | | | | multiple targets (GH-105985) (#105991) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-105938: Emit a SyntaxWarning for escaped braces in an f-string ↵Miss Islington (bot)2023-06-202-4/+9
| | | | | | | (GH-105939) (#105941) (cherry picked from commit 6586cee27f32f0354fe4e77c7b8c6e399329b5e2) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] GH-105588: Add missing error checks to some obj2ast_* converters ↵Miss Islington (bot)2023-06-151-0/+1
| | | | | | | | (GH-105838) GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) (cherry picked from commit a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* [3.12] gh-105820: Fix tok_mode expression buffer in file & readline ↵Miss Islington (bot)2023-06-151-3/+8
| | | | | | | tokenizer (GH-105828) (#105832) (cherry picked from commit d382ad49157b3802fc5619f68d96810def517869) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] gh-105800: Issue SyntaxWarning in f-strings for invalid escape ↵Miss Islington (bot)2023-06-151-3/+3
| | | | | | sequences (GH-105801) (#105806) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] gh-105718: Fix buffer allocation in tokenizer with readline ↵Miss Islington (bot)2023-06-132-5/+1
| | | | | | (GH-105728) (#105729) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] gh-105549: Tokenize separately NUMBER and NAME tokens and allow ↵Miss Islington (bot)2023-06-091-3/+10
| | | | | | 0-prefixed literals (GH-105555) (#105602) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] gh-105259: Ensure we don't show newline characters for trailing ↵Miss Islington (bot)2023-06-062-0/+8
| | | | NEWLINE tokens (GH-105364) (#105367)
* [3.12] gh-105194: Fix format specifier escaped characters in f-strings ↵Miss Islington (bot)2023-06-023-1/+21
| | | | (GH-105231) (#105234)
* [3.12] gh-104799: Default missing lists in AST to the empty list (GH-104834) ↵Miss Islington (bot)2023-06-021-20/+29
| | | | | | | | (#105213) (cherry picked from commit 77d25795862f19c6e3d647b76cfb10d5ce1f149c) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-105069: Add a readline-like callable to the tokenizer to consume ↵Miss Islington (bot)2023-05-312-3/+135
| | | | | | | | input iteratively (GH-105070) (#105119) gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (GH-105070) (cherry picked from commit 9216e69a87d16d871625721ed5a8aa302511f367) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] gh-105042: Disable unmatched parens syntax error in python tokenize ↵Miss Islington (bot)2023-05-311-32/+33
| | | | | | | | (GH-105061) (#105120) gh-105042: Disable unmatched parens syntax error in python tokenize (GH-105061) (cherry picked from commit 70f315c2d6de87b0514ce16cc00a91a5b60a6098) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] gh-104799: Move location of type_params AST fields (GH-104828) (#104974)Miss Islington (bot)2023-05-303-20/+24
| | | | | | | gh-104799: Move location of type_params AST fields (GH-104828) (cherry picked from commit ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-105017: Include CRLF lines in strings and column numbers ↵Miss Islington (bot)2023-05-283-16/+30
| | | | | | | | | (GH-105030) (#105041) gh-105017: Include CRLF lines in strings and column numbers (GH-105030) (cherry picked from commit 96fff35325e519cc76ffacf22e57e4c393d4446f) Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-105017: Fix including additional NL token when using CRLF ↵Miss Islington (bot)2023-05-271-1/+1
| | | | | | | (GH-105022) (#105023) Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] Fix typo in the tokenizer (GH-104950) (#104953)Miss Islington (bot)2023-05-261-1/+1
| | | | | (cherry picked from commit 705e387dd81b971cb1ee5727da54adfb565f61d0) Co-authored-by: Stepfen Shawn <m18824909883@163.com>
* [3.12] gh-104866: Tokenize should emit NEWLINE after exiting block with ↵Miss Islington (bot)2023-05-241-3/+6
| | | | | | | | | comment (GH-104870) (#104872) gh-104866: Tokenize should emit NEWLINE after exiting block with comment (GH-104870) (cherry picked from commit c90a862cdcf55dc1753c6466e5fa4a467a13ae24) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] GH-104668: Don't call PyOS_* hooks in subinterpreters (GH-104760)Miss Islington (bot)2023-05-231-7/+25
| | | | | | GH-104668: Don't call PyOS_* hooks in subinterpreters (GH-104674) (cherry picked from commit 357bed0bcd3c5d7c4a8caad451754a9a172aca3e) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* gh-102856: Allow comments inside multi-line f-string expresions (#104006)Cristián Maureira-Fredes2023-05-221-4/+0
|
* gh-104656: Rename typeparams AST node to type_params (#104657)Jelle Zijlstra2023-05-223-26/+26
|
* gh-98836: Extend PyUnicode_FromFormat() (GH-98838)Serhiy Storchaka2023-05-211-8/+3
| | | | | | | | | * Support for conversion specifiers o (octal) and X (uppercase hexadecimal). * Support for length modifiers j (intmax_t) and t (ptrdiff_t). * Length modifiers are now applied to all integer conversions. * Support for wchar_t C strings (%ls and %lV). * Support for variable width and precision (*). * Support for flag - (left alignment).
* gh-102856: Python tokenizer implementation for PEP 701 (#104323)Marta Gómez Macías2023-05-215-8/+65
| | | | | | | | | | | This commit replaces the Python implementation of the tokenize module with an implementation that reuses the real C tokenizer via a private extension module. The tokenize module now implements a compatibility layer that transforms tokens from the C tokenizer into Python tokenize tokens for backward compatibility. As the C tokenizer does not emit some tokens that the Python tokenizer provides (such as comments and non-semantic newlines), a new special mode has been added to the C tokenizer mode that currently is only used via the extension module that exposes it to the Python layer. This new mode forces the C tokenizer to emit these new extra tokens and add the appropriate metadata that is needed to match the old Python implementation. Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-104658: Fix location of unclosed quote error for multiline f-strings ↵Pablo Galindo Salgado2023-05-202-2/+6
| | | | (#104660)
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-163-1964/+2573
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Trim trailing whitespace and test on CI (#104275)Hugo van Kemenade2023-05-081-1/+1
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)Eric Snow2023-05-051-0/+1
| | | Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
* gh-104169: Ensure the tokenizer doesn't overwrite previous errors (#104170)Pablo Galindo Salgado2023-05-041-0/+6
|
* gh-97556: Raise null bytes syntax error upon null in multiline string ↵Lysandros Nikolaou2023-05-041-1/+8
| | | | (GH-104136)
* gh-104016: Fixed off by 1 error in f string tokenizer (#104047)jx1242023-05-012-5/+9
| | | | | | Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Ken Jin <kenjin@python.org> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-103824: fix use-after-free error in Parser/tokenizer.c (#103993)chgnrdv2023-05-011-0/+4
|
* gh-103656: Transfer f-string buffers to parser to avoid use-after-free ↵Lysandros Nikolaou2023-04-277-60/+127
| | | | | (GH-103896) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-103718: Correctly set f-string buffers in all cases (GH-103815)Lysandros Nikolaou2023-04-251-8/+6
| | | | | | Turns out we always need to remember/restore fstring buffers in all of the stack of tokenizer modes, cause they might change to `TOK_REGULAR_MODE` and have newlines inside the braces (which is when we need to reallocate the buffer and restore the fstring ones).
* GH-103727: Avoid advancing tokenizer too far in f-string mode (GH-103775)Lysandros Nikolaou2023-04-241-8/+10
|
* GH-103718: Correctly cache and restore f-string buffers when needed (GH-103719)Lysandros Nikolaou2023-04-232-11/+30
|
* gh-102310: Change error range for invalid bytes literals (#103663)Nikita Sobolev2023-04-231-1/+2
|
* gh-102856: Clean some of the PEP 701 tokenizer implementation (#103634)Pablo Galindo Salgado2023-04-192-74/+67
|
* gh-102856: Initial implementation of PEP 701 (#102855)Pablo Galindo Salgado2023-04-1910-3630/+5666
| | | | | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
* GH-102711: Fix warnings found by clang (#102712)Chenxi Mao2023-03-281-2/+2
| | | | | | | | | | | | | | | | | There are some warnings if build python via clang: Parser/pegen.c:812:31: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] _PyPegen_clear_memo_statistics() ^ void Parser/pegen.c:820:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] _PyPegen_get_memo_statistics() ^ void Fix it to make clang happy. Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
* gh-102255: Improve build support for Windows API partitions (GH-102256)Max Bachmann2023-03-091-3/+5
| | | | | Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
* gh-102416: Do not memoize incorrectly loop rules in the parser (#102467)Pablo Galindo Salgado2023-03-061-216/+0
|
* gh-100227: Move _str_replace_inf to PyInterpreterState (gh-102333)Eric Snow2023-02-281-3/+1
| | | https://github.com/python/cpython/issues/100227
* Fix some typos in asdl_c.py (GH-101757)abel15022023-02-101-2/+2
|
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-081-9/+6
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs