more robust assignment of lineno for keyword args
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 16 Feb 2000 00:51:37 +0000 (00:51 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 16 Feb 2000 00:51:37 +0000 (00:51 +0000)
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):

Lib/compiler/transformer.py
Tools/compiler/compiler/transformer.py

index 9c8b32ea62a0fa57b545d33e4af584ee1c80894a..18ec815da8f44517818c928c82c695f20d6e509a 100644 (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
index 9c8b32ea62a0fa57b545d33e4af584ee1c80894a..18ec815da8f44517818c928c82c695f20d6e509a 100644 (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