summaryrefslogtreecommitdiffstats
path: root/Tools/compiler
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-03-09 22:31:45 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-03-09 22:31:45 (GMT)
commitca4d08b6d366ef12022c15ea546ecf7a19a087e7 (patch)
tree4e6acfb06f494483c0e4953033a214252b3a9e54 /Tools/compiler
parent51f77b5152dbec3b6d105d9bf53af8d8a7b2abe5 (diff)
downloadcpython-ca4d08b6d366ef12022c15ea546ecf7a19a087e7.zip
cpython-ca4d08b6d366ef12022c15ea546ecf7a19a087e7.tar.gz
cpython-ca4d08b6d366ef12022c15ea546ecf7a19a087e7.tar.bz2
NodeInfo.__gen_init(): Fiddle so that reindent.py is
happy with the output as-is. This incidentally also gets rid of "an extra" blank line at the end of the output block that probably wasn't intended (although it doesn't matter one way or the other).
Diffstat (limited to 'Tools/compiler')
-rw-r--r--Tools/compiler/astgen.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Tools/compiler/astgen.py b/Tools/compiler/astgen.py
index e6aa350..59b98f2 100644
--- a/Tools/compiler/astgen.py
+++ b/Tools/compiler/astgen.py
@@ -113,8 +113,11 @@ class NodeInfo:
for name in self.argnames:
print >> buf, " self.%s = %s" % (name, name)
print >> buf, " self.lineno = lineno"
- if self.init:
- print >> buf, "".join([" " + line for line in self.init])
+ # Copy the lines in self.init, indented four spaces. The rstrip()
+ # business is to get rid of the four spaces if line happens to be
+ # empty, so that reindent.py is happy with the output.
+ for line in self.init:
+ print >> buf, (" " + line).rstrip()
def _gen_getChildren(self, buf):
print >> buf, " def getChildren(self):"