From 09aaa88328a5083469b2682230c7f3c62942afab Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 23 Feb 2008 15:01:06 +0000 Subject: Patch from Georg Brandl: Fix co_lineno of decorated function and class objects. If you see an error in test_inspect please delete all pyc files. --- Python/ast.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Python/ast.c') diff --git a/Python/ast.c b/Python/ast.c index 97486c5515..8b68182582 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1015,6 +1015,12 @@ ast_for_decorated(struct compiling *c, const node *n) } else if (TYPE(CHILD(n, 1)) == classdef) { thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq); } + /* we count the decorators in when talking about the class' or + * function's line number */ + if (thing) { + thing->lineno = LINENO(n); + thing->col_offset = n->n_col_offset; + } return thing; } -- cgit v1.2.1