Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca4d08b

Browse files
committed
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).
1 parent 51f77b5 commit ca4d08b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Tools/compiler/astgen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ def _gen_init(self, buf):
113113
for name in self.argnames:
114114
print >> buf, " self.%s = %s" % (name, name)
115115
print >> buf, " self.lineno = lineno"
116-
if self.init:
117-
print >> buf, "".join([" " + line for line in self.init])
116+
# Copy the lines in self.init, indented four spaces. The rstrip()
117+
# business is to get rid of the four spaces if line happens to be
118+
# empty, so that reindent.py is happy with the output.
119+
for line in self.init:
120+
print >> buf, (" " + line).rstrip()
118121

119122
def _gen_getChildren(self, buf):
120123
print >> buf, " def getChildren(self):"

0 commit comments

Comments
 (0)