more robust assignment of lineno for keyword args

get the lineno from the name of the keyword arg

example of case that didn't work--
def foo(x, y, a = None,
	b = None):
This commit is contained in:
Jeremy Hylton 2000-02-16 00:51:37 +00:00
parent 2ce27b223b
commit 3d9f5e4de2
2 changed files with 6 additions and 6 deletions

View File

@ -993,9 +993,9 @@ class Transformer:
n = n[1]
if n[0] != token.NAME:
raise SyntaxError, "keyword can't be an expression (%s)"%n[0]
n = Node('keyword', n[1], result)
n.lineno = result.lineno
return 1, n
node = Node('keyword', n[1], result)
node.lineno = n[2]
return 1, node
def com_subscriptlist(self, primary, nodelist, assigning):
# slicing: simple_slicing | extended_slicing

View File

@ -993,9 +993,9 @@ class Transformer:
n = n[1]
if n[0] != token.NAME:
raise SyntaxError, "keyword can't be an expression (%s)"%n[0]
n = Node('keyword', n[1], result)
n.lineno = result.lineno
return 1, n
node = Node('keyword', n[1], result)
node.lineno = n[2]
return 1, node
def com_subscriptlist(self, primary, nodelist, assigning):
# slicing: simple_slicing | extended_slicing