summaryrefslogtreecommitdiff
path: root/Python/ast.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode ↵Serhiy Storchaka2020-04-111-1/+1
| | | | data. (GH-19345)
* bpo-40141: Include the value in the column position for keyword AST nodes ↵Pablo Galindo2020-04-031-1/+1
| | | | (GH-19348)
* bpo-40147: Move the check for duplicate keywords to the compiler (GH-19289)Pablo Galindo2020-04-031-10/+1
|
* bpo-40141: Add line and column information to ast.keyword nodes (GH-19283)Pablo Galindo2020-04-021-2/+5
|
* bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157)Victor Stinner2020-03-251-6/+3
|
* bpo-40000: Improve error messages when validating invalid ast.Constant nodes ↵Batuhan Taşkaya2020-03-191-3/+5
| | | | | (GH-19055) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39988: Remove ast.AugLoad and ast.AugStore node classes. (GH-19038)Serhiy Storchaka2020-03-171-12/+1
|
* bpo-39969: Remove ast.Param node class as is no longer used (GH-19020)Batuhan Taşkaya2020-03-151-2/+0
|
* bpo-34822: Simplify AST for subscription. (GH-9605)Serhiy Storchaka2020-03-101-67/+21
| | | | | | | | | * 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.
* bpo-39639: Remove the AST "Suite" node and associated code (GH-18513)Batuhan Taşkaya2020-03-041-3/+0
| | | | | | | | The AST "Suite" node is no longer used and it can be removed from the ASDL definition and related structures (compiler, visitors, ...). Co-Authored-By: Victor Stinner <vstinner@python.org> Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39702: Relax grammar restrictions on decorators (PEP 614) (GH-18570)Brandt Bucher2020-03-031-68/+4
|
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Serhiy Storchaka2020-02-121-18/+18
|
* bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405)Lysandros Nikolaou2020-02-071-2/+3
|
* bpo-39235: Fix end location for genexp in call args (GH-17925)Guido van Rossum2020-01-091-8/+8
| | | | | | The fix changes copy_location() to require an extra node from which to extract the end location, and fixing all 5 call sites. https://bugs.python.org/issue39235
* bpo-39176: Improve error message for 'named assignment' (GH-17777)Ned Batchelder2019-12-311-1/+1
|
* bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645)Lysandros Nikolaou2019-12-181-1/+1
| | | | Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
* The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586)Guido van Rossum2019-12-151-3/+1
| | | Automerge-Triggered-By: @gvanrossum
* Fix elif start column offset when there is an else following (GH-17596)Lysandros Nikolaou2019-12-141-2/+2
|
* bpo-39031: Include elif keyword when producing lineno/col-offset info for ↵Lysandros Nikolaou2019-12-121-2/+2
| | | | | | | | | | | | if_stmt (GH-17582) When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. https://bugs.python.org/issue39031 Automerge-Triggered-By: @pablogsal
* bpo-38535: Fix positions for AST nodes for calls without arguments in ↵Serhiy Storchaka2019-10-261-2/+4
| | | | decorators. (GH-16861)
* Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)Greg Price2019-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | All call sites pass NULL for `recode_encoding`, so this path is completely untested. That's been true since before Python 3.0. It adds significant complexity to this logic, so it's best to take it out. All call sites now have a literal NULL, and that's been true since commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at the call site in Python/ast.c where we're parsing a bytes literal. But even before then, that condition `foo` had been a constant since unadorned string literals started meaning Unicode, in commit 572dbf8f1 aka v3.0a1~1035 . The `unicode` parameter is already unused, so mark it as unused too. The code that acted on it was also taken out before Python 3.0, in commit 8d30cc014 aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
* bpo-38138: Fix memory leak introduced by interned strings (GH-16053)Dino Viehland2019-09-121-0/+1
| | | | | | | | | | | Interned string needs to be decref'd https://bugs.python.org/issue38138 Automerge-Triggered-By: @matrixise
* bpo-38113: Update Python/ast.c to PEP-384 (GH-15975)Dino Viehland2019-09-111-4/+3
| | | | | | | | | | Removes statics for better subinterpreter support and moves to _PyType_Name https://bugs.python.org/issue38113 Automerge-Triggered-By: @tiran
* Fix typos mostly in comments, docs and test names (GH-15209)Min ho Kim2019-08-301-1/+1
|
* bpo-32912: Revert SyntaxWarning on invalid escape sequences. (GH-15195)Gregory P. Smith2019-08-101-3/+3
| | | | | | | | | | | | | | | | | | DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals just as it did in 3.7. SyntaxWarning may be emitted in the future. But per mailing list discussion, we don't yet know when because we haven't settled on how to do so in a non-disruptive manner. (Applies 4c5b6bac2408f879231c7cd38d67657dd4804e7c to the master branch). (This is https://github.com/python/cpython/pull/15142 for master/3.9) https://bugs.python.org/issue32912 Automerge-Triggered-By: @gpshead
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-37593: Swap the positions of posonlyargs and args in the constructor of ↵Pablo Galindo2019-07-141-1/+1
| | | | | ast.parameters nodes (GH-14778) https://bugs.python.org/issue37593
* bpo-18374: fix wrong col_offset of some ast.BinOp instances (GH-14607)Carl Friedrich Bolz-Tereick2019-07-081-1/+1
| | | | | Nested BinOp instances (e.g. a+b+c) had a wrong col_offset for the second BinOp (e.g. 2 instead of 0 in the example). Fix it by using the correct st node to copy the line and col_offset from in ast.c.
* remove dead code (GH-14104)David Carlier2019-06-181-3/+0
| | | default case ought to handle the "unexpected".
* bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018)Victor Stinner2019-06-131-2/+1
| | | | | Add a new _PyCompilerFlags_INIT macro to initialize PyCompilerFlags variables, rather than initializing cf_flags and cf_feature_version explicitly in each variable.
* bpo-35814: Allow unpacking in r.h.s of annotated assignment expressions ↵Pablo Galindo2019-06-031-1/+1
| | | | (GH-13760)
* bpo-37112: Allow compile to work on AST with positional only arguments with ↵Pablo Galindo2019-05-311-1/+1
| | | | defaults (GH-13697)
* bpo-37070: Cleanup fstring debug handling (GH-13607)Eric V. Smith2019-05-291-27/+18
| | | | * Clean up some comments, fix potential memory leaks, clarify literal and expr_text.
* bpo-37072: Fix crash in PyAST_FromNodeObject() when flags is NULL (#13634)Guido van Rossum2019-05-281-1/+1
| | | | | I'm confident that this fixes the reported crash. flags=NULL is treated as using the latest minor version. https://bugs.python.org/issue37072
* bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node ↵Eric V. Smith2019-05-271-44/+46
| | | | | 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-36878: Track extra text added to 'type: ignore' in the AST (GH-13479)Michael J. Sullivan2019-05-221-1/+4
| | | | | GH-13238 made extra text after a # type: ignore accepted by the parser. This finishes the job and actually plumbs the extra text through the parser and makes it available in the AST.
* Fix couple of dead code paths (GH-7418)David Carlier2019-05-171-3/+0
|
* bpo-36817: Do not decrement reference for expr_text on fstring = parsing ↵Pablo Galindo2019-05-121-1/+0
| | | | failure (GH-13256)
* bpo-36817: Fix reference leak for expr_text in f-string = parsing (GH-13249)Pablo Galindo2019-05-111-2/+7
|
* bpo-36817: Add f-string debugging using '='. (GH-13123)Eric V. Smith2019-05-081-29/+83
| | | 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-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-18/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-36495: Fix two out-of-bounds array reads (GH-12641)Brad Larsen2019-04-011-2/+2
| | | Research and fix by @bradlarsen.
* bpo-36332: Allow compile() to handle AST objects with assignment expressions ↵Pablo Galindo2019-03-181-3/+4
| | | | | | (GH-12398)
* bpo-36280: Add Constant.kind field (GH-12295)Guido van Rossum2019-03-131-7/+46
| | | | | | | | | | | | | | The value is a string for string and byte literals, None otherwise. It is 'u' for u"..." literals, 'b' for b"..." literals, '' for "..." literals. The 'r' (raw) prefix is ignored. Does not apply to f-strings. This appears sufficient to make mypy capable of using the stdlib ast module instead of typed_ast (assuming a mypy patch I'm working on). WIP: I need to make the tests pass. @ilevkivskyi @serhiy-storchaka https://bugs.python.org/issue36280
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-19/+81
| | | | | | | This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.) https://bugs.python.org/issue35975
* bpo-36187: Remove NamedStore. (GH-12167)Serhiy Storchaka2019-03-051-109/+90
| | | | | NamedStore has been replaced with Store. The difference between NamedStore and Store is handled when precess the NamedExpr node one level upper.
* bpo-36052: Raise a SyntaxError when assigning a value to __debug__ with := ↵Stéphane Wirtel2019-02-211-1/+1
| | | | | | | (GH-11958) Trying to assign a value to __debug__ using the assignment operator is supposed to fail, but a missing check for forbidden names when setting the context in the ast was preventing this behaviour.
* bpo-36049: Fix compiler warning in Python/ast.c (GH-11949)Pablo Galindo2019-02-191-1/+1
|
* bpo-35766 follow-up: Add an error check to new_type_comment() (#11766)Guido van Rossum2019-02-111-0/+2
| | | | If PyUnicode_DecodeUTF8() returns NULL, PyArena_AddPyObject() would crash. Found by @msullivan for https://github.com/python/typed_ast/pull/93.
* Fix compiler warning about non initialised variable (GH-11806)Pablo Galindo2019-02-101-2/+2
|