mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag. Patch by Florent Xicluna.
This commit is contained in:
parent
b9c3ed4f82
commit
b9d4963a98
18 changed files with 99 additions and 88 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue