summaryrefslogtreecommitdiffstats
path: root/Doc/library/ast.rst
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38870: Extend subject of ast.unparse warnings (GH-21053)Batuhan Taskaya2020-06-281-1/+6
| | | | | | | - Mention that some compiler optimizations might not roundtrip exactly (such as constant tuples and frozensets). - Add a warning about it might raise RecursionError on very complex expressions due to recursive unparsing aspect of ast.unparse
* bpo-40517: Implement syntax highlighting support for ASDL (GH-19967)Batuhan Taskaya2020-05-071-1/+1
|
* Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" ↵Raymond Hettinger2020-05-061-1/+1
| | | | | (#19950) This reverts commit d60040ba226bd2e3b6f58d074015aa2499dc1cb8.
* bpo-40517: Implement syntax highlighting support for ASDL (#19928)Batuhan Taskaya2020-05-061-1/+1
|
* Fix syntax error in an example in the ast documentation and sync docstrings ↵Pablo Galindo2020-03-121-1/+1
| | | | (GH-18946)
* bpo-34822: Simplify AST for subscription. (GH-9605)Serhiy Storchaka2020-03-101-37/+31
| | | | | | | | | * 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-36287: Make ast.dump() not output optional fields and attributes with ↵Serhiy Storchaka2020-03-091-99/+75
| | | | | | | default values. (GH-18843) The default values for optional fields and attributes of AST nodes are now set as class attributes (e.g. Constant.kind is set to None).
* bpo-39199: Use 'eval' mode for the examples with expression nodes (GH-18828)Pablo Galindo2020-03-071-292/+211
| | | Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39199: Add descriptions of non-deprecated nodes to the AST module ↵Pablo Galindo2020-03-021-6/+1497
| | | | | | | | | documentation (GH-17812) Adapted from https://greentreesnakes.readthedocs.io Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* bpo-32892: Update the documentation for handling constants in AST. (GH-18514)Serhiy Storchaka2020-02-171-3/+7
|
* bpo-3530: Add advice on when to correctly use fix_missing_locations in the ↵Batuhan Taşkaya2020-01-121-1/+9
| | | | | | AST docs (GH-17172) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39158: ast.literal_eval() doesn't support empty sets (GH-17742)Raymond Hettinger2020-01-031-0/+3
|
* bpo-39136: Fixed typos (GH-17720)Gurupad Hegde2019-12-281-1/+1
| | | | | funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape,
* bpo-38348: Extend command line options of ast parsing tool (GH-16540)Batuhan Taşkaya2019-12-161-0/+9
| | | | Add -i and --indent (indentation level), and --no-type-comments (type comments) command line options to ast parsing tool.
* bpo-38870: Expose a function to unparse an ast object in the ast module ↵Pablo Galindo2019-11-241-0/+13
| | | | | | | (GH-17302) Add ast.unparse() as a function in the ast module that can be used to unparse an ast.AST object and produce a string with code that would produce an equivalent ast.AST object when parsed.
* bpo-38049: Add command-line interface for the ast module. (GH-15724)Serhiy Storchaka2019-09-091-0/+36
|
* bpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)Serhiy Storchaka2019-09-091-1/+12
|
* bpo-37950: Fix ast.dump() when call with incompletely initialized node. ↵Serhiy Storchaka2019-08-291-4/+5
| | | | (GH-15510)
* bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). ↵Serhiy Storchaka2019-08-261-0/+7
| | | | | | | (GH-15490) It emits a deprecation warning and calls corresponding method visit_Num(), visit_Str(), etc.
* bpo-35766: Change format for feature_version to (major, minor) (GH-13992)Guido van Rossum2019-06-121-6/+7
| | | | | | | (A single int is still allowed, but undocumented.) https://bugs.python.org/issue35766
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-2/+8
| | | | | | | 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-35766: Merge typed_ast back into CPython (GH-11645)Guido van Rossum2019-01-311-1/+18
|
* bpo-33416: Add end positions to Python AST (GH-11605)Ivan Levkivskyi2019-01-221-9/+31
| | | | | | | | | | | | | | | | | | The majority of this PR is tediously passing `end_lineno` and `end_col_offset` everywhere. Here are non-trivial points: * It is not possible to reconstruct end positions in AST "on the fly", some information is lost after an AST node is constructed, so we need two more attributes for every AST node `end_lineno` and `end_col_offset`. * I add end position information to both CST and AST. Although it may be technically possible to avoid adding end positions to CST, the code becomes more cumbersome and less efficient. * Since the end position is not known for non-leaf CST nodes while the next token is added, this requires a bit of extra care (see `_PyNode_FinalizeEndPos`). Unless I made some mistake, the algorithm should be linear. * For statements, I "trim" the end position of suites to not include the terminal newlines and dedent (this seems to be what people would expect), for example in ```python class C: pass pass ``` the end line and end column for the class definition is (2, 8). * For `end_col_offset` I use the common Python convention for indexing, for example for `pass` the `end_col_offset` is 4 (not 3), so that `[0:4]` gives one the source code that corresponds to the node. * I added a helper function `ast.get_source_segment()`, to get source text segment corresponding to a given AST node. It is also useful for testing. An (inevitable) downside of this PR is that AST now takes almost 25% more memory. I think however it is probably justified by the benefits.
* bpo-35054: Add yet more index entries for symbols. (GH-10121)Serhiy Storchaka2018-10-281-0/+3
|
* bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)Serhiy Storchaka2018-09-271-4/+11
|
* bpo-32911: Revert bpo-29463. (GH-7121) (GH-7197)Serhiy Storchaka2018-05-291-4/+0
| | | | | | Remove the docstring attribute of AST types and restore docstring expression as a first stmt in their body. Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the ↵Brett Cannon2018-03-091-0/+10
| | | | interpreter (GH-5960)
* bpo-25910: Link redirections in docs (#1933)Sanyam Khurana2018-01-201-1/+1
| | | Fixes some redirection links in docs.
* bpo-29463: Add docstring field to some AST nodes. (#46)INADA Naoki2017-02-221-3/+11
| | | | | | | | | | | * bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
* Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.Martin Panter2016-07-261-0/+1
| | | | Patch by Julien Palard.
* Issue16544 - Add a link to an external documentation resource in ast module ↵Senthil Kumaran2016-01-071-0/+5
| | | | docs.
* Fix a few grammar problems in the documentation and commentsMartin Panter2015-11-141-1/+1
|
* Closes #22525: clarify documentation for ast.literal_eval().Georg Brandl2014-11-051-7/+9
|
* Issue #19795: Improved markup of True/False constants.Serhiy Storchaka2013-11-291-1/+1
|
* remove ast.__version__ (closes #12273)Benjamin Peterson2011-07-161-3/+0
|
* convert ast versioning to mercurialBenjamin Peterson2011-03-131-2/+2
|
* Issue #11000 ast.parse parses source, not just expressions.Terry Reedy2011-01-241-2/+2
|
* Separate source link from main text.Raymond Hettinger2011-01-101-0/+2
|
* Move source links to consistent location and remove wordy, big yellow boxes.Raymond Hettinger2011-01-101-3/+1
|
* #10869: do not visit root node twice in ast.increment_lineno().Georg Brandl2011-01-091-3/+3
|
* Provide links to Python source where the code is short, readable andÉric Araujo2010-11-161-0/+3
| | | | | informative adjunct to the docs. Forward-port of Raymond's r86225 and r86245 using the new source reST role added in #10334.
* Issue #7061: Dropped "for Tk" from turtle module title and moved itsAlexander Belopolsky2010-10-271-4/+2
| | | | | doc section under frameworks. Also fixed a couple of markup issues that affected TOC rendering.
* Add bytes in literal_eval doc.Georg Brandl2010-07-131-3/+3
|
* Allow set literals in literal_eval().Georg Brandl2010-07-111-2/+5
|
* Merged revisions 74209 via svnmerge fromGeorg Brandl2009-07-261-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74209 | georg.brandl | 2009-07-26 16:37:28 +0200 (So, 26 Jul 2009) | 1 line builtin -> built-in. ........
* Remove trailing whitespace.Georg Brandl2009-01-031-2/+2
|
* Merged revisions 68219 via svnmerge fromGeorg Brandl2009-01-031-6/+6
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68219 | georg.brandl | 2009-01-03 21:47:01 +0100 (Sat, 03 Jan 2009) | 2 lines Fix uses of the default role. ........
* Merged revisions 67162 via svnmerge fromBenjamin Peterson2008-11-081-6/+5
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r67162 | benjamin.peterson | 2008-11-08 10:55:33 -0600 (Sat, 08 Nov 2008) | 1 line a few compile() and ast doc improvements ........
* murder some versionadded and versionchanged directives in their bedsBenjamin Peterson2008-08-161-8/+0
|
* Merged revisions ↵Benjamin Peterson2008-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 64434-64435,64440-64443,64445,64447-64448,64450,64452,64455,64461,64464,64466,64468 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r64434 | andrew.kuchling | 2008-06-20 18:13:58 -0500 (Fri, 20 Jun 2008) | 1 line Remove request for e-mail; it's unlikely these classes will be saved ........ r64435 | andrew.kuchling | 2008-06-20 18:14:32 -0500 (Fri, 20 Jun 2008) | 1 line Grammar fixes ........ r64440 | andrew.kuchling | 2008-06-21 08:29:12 -0500 (Sat, 21 Jun 2008) | 1 line Docstring typo ........ r64441 | andrew.kuchling | 2008-06-21 08:47:20 -0500 (Sat, 21 Jun 2008) | 1 line Use repr() for bad input strings; this makes the empty string or binary characters more visible ........ r64442 | andrew.kuchling | 2008-06-21 08:48:38 -0500 (Sat, 21 Jun 2008) | 1 line Docstring correction ........ r64443 | georg.brandl | 2008-06-21 09:26:19 -0500 (Sat, 21 Jun 2008) | 2 lines Documentation fix. ........ r64445 | facundo.batista | 2008-06-21 12:30:06 -0500 (Sat, 21 Jun 2008) | 3 lines Reviewed and updated the documentation. Fixes #3017. ........ r64447 | facundo.batista | 2008-06-21 13:58:04 -0500 (Sat, 21 Jun 2008) | 6 lines Now a from submitted via POST that also has a query string will contain both FieldStorage and MiniFieldStorage items. Fixes #1817. ........ r64448 | facundo.batista | 2008-06-21 14:48:19 -0500 (Sat, 21 Jun 2008) | 5 lines In the deprecated functions I added an alert to review specially a section of the subprocess documentation that helps with the replacing of those functionss. ........ r64450 | georg.brandl | 2008-06-22 04:05:29 -0500 (Sun, 22 Jun 2008) | 2 lines Turn section references into proper cross-references. ........ r64452 | facundo.batista | 2008-06-22 08:36:20 -0500 (Sun, 22 Jun 2008) | 5 lines Issue #2722. Now the char buffer to support the path string has not fixed length, it mallocs memory if needed. As a result, we don't have a maximum for the getcwd() method. ........ r64455 | facundo.batista | 2008-06-22 10:27:10 -0500 (Sun, 22 Jun 2008) | 4 lines Issue 3164. Small fix to don't repeat a comparation without necessity. ........ r64461 | georg.brandl | 2008-06-22 13:11:52 -0500 (Sun, 22 Jun 2008) | 2 lines #3085: Fix syntax error. ........ r64464 | georg.brandl | 2008-06-22 13:31:54 -0500 (Sun, 22 Jun 2008) | 2 lines Expand docstrings of sqlite3 functions. ........ r64466 | georg.brandl | 2008-06-22 14:07:59 -0500 (Sun, 22 Jun 2008) | 2 lines Write out "phi" consistently. ........ r64468 | facundo.batista | 2008-06-22 14:35:24 -0500 (Sun, 22 Jun 2008) | 4 lines Just returning nothing instead of rising TestSkipped, because it makes the test fail in the trunk.loewis-sun buildbot. ........