From 3d9f5e4de2f3230cc79a92eee7682a74abd52724 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 16 Feb 2000 00:51:37 +0000 Subject: 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): --- Lib/compiler/transformer.py | 6 +++--- Tools/compiler/compiler/transformer.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 9c8b32e..18ec815 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -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 diff --git a/Tools/compiler/compiler/transformer.py b/Tools/compiler/compiler/transformer.py index 9c8b32e..18ec815 100644 --- a/Tools/compiler/compiler/transformer.py +++ b/Tools/compiler/compiler/transformer.py @@ -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 -- cgit v0.12