summaryrefslogtreecommitdiffstats
path: root/Tools/compiler/astgen.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-04 23:22:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-04 23:22:44 (GMT)
commitb9d4963a989accce30234b7b74bce874c0142209 (patch)
tree63fa25095a756b9def7c84cf7eb88d68c2412e29 /Tools/compiler/astgen.py
parentb9c3ed4f82d3551c9906da55ddb8059ac3b5ce94 (diff)
downloadcpython-b9d4963a989accce30234b7b74bce874c0142209.zip
cpython-b9d4963a989accce30234b7b74bce874c0142209.tar.gz
cpython-b9d4963a989accce30234b7b74bce874c0142209.tar.bz2
Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag. Patch by Florent Xicluna.
Diffstat (limited to 'Tools/compiler/astgen.py')
-rw-r--r--Tools/compiler/astgen.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tools/compiler/astgen.py b/Tools/compiler/astgen.py
index c431d22..1724276 100644
--- a/Tools/compiler/astgen.py
+++ b/Tools/compiler/astgen.py
@@ -105,12 +105,18 @@ class NodeInfo:
def _gen_init(self, buf):
if self.args:
- print >> buf, " def __init__(self, %s, lineno=None):" % self.args
+ argtuple = '(' in self.args
+ args = self.args if not argtuple else ''.join(self.argnames)
+ print >> buf, " def __init__(self, %s, lineno=None):" % args
else:
print >> buf, " def __init__(self, lineno=None):"
if self.argnames:
- for name in self.argnames:
- print >> buf, " self.%s = %s" % (name, name)
+ if argtuple:
+ for idx, name in enumerate(self.argnames):
+ print >> buf, " self.%s = %s[%s]" % (name, args, idx)
+ else:
+ for name in self.argnames:
+ print >> buf, " self.%s = %s" % (name, name)
print >> buf, " self.lineno = lineno"
# 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