<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Include/node.h, branch misc-acks-comment</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-33416: Add end positions to Python AST (GH-11605)</title>
<updated>2019-01-22T11:18:22+00:00</updated>
<author>
<name>Ivan Levkivskyi</name>
<email>levkivskyi@gmail.com</email>
</author>
<published>2019-01-22T11:18:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9932a22897ef9905161dac7476e6976370e13515'/>
<id>9932a22897ef9905161dac7476e6976370e13515</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-32150: Expand tabs to spaces in C files. (#4583)</title>
<updated>2017-11-28T15:56:10+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2017-11-28T15:56:10+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=598ceae876ff4a23072e59945597e945583de4ab'/>
<id>598ceae876ff4a23072e59945597e945583de4ab</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Removed trailing tabs.</title>
<updated>2015-03-21T07:25:53+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2015-03-21T07:25:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f402775e5d886e76613101c5ec75616e7628293c'/>
<id>f402775e5d886e76613101c5ec75616e7628293c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Issue #18637: Fixed an error in _PyNode_SizeOf declaration.</title>
<updated>2014-11-18T15:30:15+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2014-11-18T15:30:15+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=60fe569673eecaffd4afccd9b4d8a2c2bb4df15e'/>
<id>60fe569673eecaffd4afccd9b4d8a2c2bb4df15e</id>
<content type='text'>
Patch by Roumen Petrov.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Patch by Roumen Petrov.
</pre>
</div>
</content>
</entry>
<entry>
<title>MERGE: Closes #15512: Correct __sizeof__ support for parser</title>
<updated>2012-08-03T12:29:26+00:00</updated>
<author>
<name>Jesus Cea</name>
<email>jcea@jcea.es</email>
</author>
<published>2012-08-03T12:29:26+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=88ca04e6a8d1e5b31da69717e0e0cde2c069d7eb'/>
<id>88ca04e6a8d1e5b31da69717e0e0cde2c069d7eb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Closes #15512: Correct __sizeof__ support for parser</title>
<updated>2012-08-03T12:28:37+00:00</updated>
<author>
<name>Jesus Cea</name>
<email>jcea@jcea.es</email>
</author>
<published>2012-08-03T12:28:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=e9c5318967e1e62e940b72cd47502a1a3b559b95'/>
<id>e9c5318967e1e62e940b72cd47502a1a3b559b95</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>move LINENO define to where it actually belongs</title>
<updated>2012-01-16T22:29:05+00:00</updated>
<author>
<name>Benjamin Peterson</name>
<email>benjamin@python.org</email>
</author>
<published>2012-01-16T22:29:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=c0beabc2a57f6599a411d3b5579dd6c64ffd47b7'/>
<id>c0beabc2a57f6599a411d3b5579dd6c64ffd47b7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Patch #1440601: Add col_offset attribute to AST nodes.</title>
<updated>2006-03-01T22:49:05+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2006-03-01T22:49:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=49c5da1d88f605248167f4d95b1dfe08c1f703c7'/>
<id>49c5da1d88f605248167f4d95b1dfe08c1f703c7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>PEP-0318, @decorator-style. In Guido's words:</title>
<updated>2004-08-02T06:10:11+00:00</updated>
<author>
<name>Anthony Baxter</name>
<email>anthonybaxter@gmail.com</email>
</author>
<published>2004-08-02T06:10:11+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=c2a5a636545a88f349dbe3e452ffb4494b68e534'/>
<id>c2a5a636545a88f349dbe3e452ffb4494b68e534</id>
<content type='text'>
"@ seems the syntax that everybody can hate equally"
Implementation by Mark Russell, from SF #979728.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
"@ seems the syntax that everybody can hate equally"
Implementation by Mark Russell, from SF #979728.
</pre>
</div>
</content>
</entry>
<entry>
<title>Back out the previous change.  It doesn't save any space on 64-bit</title>
<updated>2002-09-17T03:27:02+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2002-09-17T03:27:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=e5de77800e905a4bc90f7568eb106aa9e276b590'/>
<id>e5de77800e905a4bc90f7568eb106aa9e276b590</id>
<content type='text'>
platforms.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
platforms.
</pre>
</div>
</content>
</entry>
</feed>
