summaryrefslogtreecommitdiffstats
path: root/Parser/string_parser.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-94869: Fix the location in some expressions for multi-line f-string ast ↵Miss Islington (bot)2022-07-161-1/+4
| | | | | | | | | nodes (GH-94895) (#94911) (cherry picked from commit 2e9da8e3522764d09f1d6054a2be567e91a30812) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-93418: Fix an assert when an f-string expression is followed by an '=', ↵Miss Islington (bot)2022-06-021-1/+3
| | | | | | | | | but no closing brace. (gh-93419) (gh-93423) (cherry picked from commit ee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com> Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
* bpo-46762: Fix an assert failure in f-strings where > or < is the last ↵Miss Islington (bot)2022-02-161-10/+10
| | | | | | | character if the f-string is missing a trailing right brace. (GH-31365) (cherry picked from commit ffd9f8ff84ed53c956b16d027f7d2926ea631051) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
* bpo-46503: Prevent an assert from firing when parsing some invalid \N ↵Miss Islington (bot)2022-01-251-2/+14
| | | | | | | | | | | | sequences in f-strings. (GH-30865) (GH-30866) * bpo-46503: Prevent an assert from firing. Also fix one nearby tiny PEP-7 nit. * Added blurb. (cherry picked from commit 0daf72194bd4e31de7f12020685bb39a14d6f45e) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com> Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
* bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)Miss Islington (bot)2022-01-111-1/+4
| | | | | (cherry picked from commit 6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the ↵Miss Islington (bot)2021-10-141-1/+1
| | | | | | | | | | | | "unicode-escape" codec (GH-28939) (GH-28943) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.unicode_escape_decode(). It is True by default to match the former behavior. (cherry picked from commit c96d1546b11b4c282a7e21737cb1f5d16349656d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] bpo-44885: Correct the ast locations of f-strings with format specs ↵Pablo Galindo Salgado2021-08-121-38/+30
| | | | | | | and repeated expressions (GH-27729) (GH-27743) (cherry picked from commit 8e832fb2a2cb54d7262148b6ec15563dffb48d63) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] Add more const modifiers. (GH-26691). (GH-26692)Serhiy Storchaka2021-06-121-5/+5
| | | | | (cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582)Miss Islington (bot)2021-06-081-2/+2
| | | | | (cherry picked from commit ffd87b7093109c279caf8e3ca060f408a102388a) Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)Victor Stinner2021-04-071-8/+11
| | | | | | Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix. Remove macros creating aliases without prefix. For example, Module() becomes _PyAST_Module(). Update Grammar/python.gram to use _PyAST_xxx() functions.
* bpo-43244: Remove the pyarena.h header (GH-25007)Victor Stinner2021-03-241-1/+1
| | | | | | | | | | | | | | | | | | Remove the pyarena.h header file with functions: * PyArena_New() * PyArena_Free() * PyArena_Malloc() * PyArena_AddPyObject() These functions were undocumented, excluded from the limited C API, and were only used internally by the compiler. Add pycore_pyarena.h header. Rename functions: * PyArena_New() => _PyArena_New() * PyArena_Free() => _PyArena_Free() * PyArena_Malloc() => _PyArena_Malloc() * PyArena_AddPyObject() => _PyArena_AddPyObject()
* Remove full stop from a bytes-related SyntaxError message (GH-24300)numbermaniac2021-01-231-1/+1
|
* bpo-42806: Fix ast locations of f-strings inside parentheses (GH-24067)Pablo Galindo2021-01-031-1/+1
|
* bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner2020-12-011-1/+1
| | | | | | | | | | | No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
* bpo-40998: Address compiler warnings found by ubsan (GH-20929)Christian Heimes2020-11-181-0/+3
| | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
* bpo-41746: Add type information to asdl_seq objects (GH-22223)Pablo Galindo2020-09-161-4/+4
| | | | | | | | | | | | | * 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.
* Fix trivial typo in the PEG string parser (GH-21508)Eric V. Smith2020-07-161-1/+1
|
* Fix possibly-unitialized warning in string_parser.c. (GH-21503)Benjamin Peterson2020-07-161-15/+16
| | | | | | | | | | | | | | | | | | | | GCC says ``` ../cpython/Parser/string_parser.c: In function ‘fstring_find_expr’: ../cpython/Parser/string_parser.c:404:93: warning: ‘cols’ may be used uninitialized in this function [-Wmaybe-uninitialized] 404 | p2->starting_col_offset = p->tok->first_lineno == p->tok->lineno ? t->col_offset + cols : cols; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ ../cpython/Parser/string_parser.c:384:16: note: ‘cols’ was declared here 384 | int lines, cols; | ^~~~ ../cpython/Parser/string_parser.c:403:45: warning: ‘lines’ may be used uninitialized in this function [-Wmaybe-uninitialized] 403 | p2->starting_lineno = t->lineno + lines - 1; | ~~~~~~~~~~~~~~~~~~^~~ ../cpython/Parser/string_parser.c:384:9: note: ‘lines’ was declared here 384 | int lines, cols; | ^~~~~ ``` and, indeed, if `PyBytes_AsString` somehow fails, lines & cols will not be initialized.
* bpo-41076: Pre-feed the parser with the f-string expression location (GH-21054)Lysandros Nikolaou2020-06-271-242/+22
| | | This commit changes the parsing of f-string expressions with the new parser. The parser gets pre-fed with the location of the expression itself (not the f-string, which was what we were doing before). This allows us to completely skip the shifting of the AST nodes after the parsing is completed.
* bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173)Lysandros Nikolaou2020-06-271-7/+7
|
* Remove old comment in string_parser.c (GH-20906)Pablo Galindo2020-06-161-5/+0
|
* Improve readability and style in parser files (GH-20884)Pablo Galindo2020-06-151-98/+130
|
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-111-0/+1421
This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.