summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-23 15:01:06 +0000
committerChristian Heimes <christian@cheimes.de>2008-02-23 15:01:06 +0000
commit776d7d68d31c3f5ddeb1e892b9d29252ee352480 (patch)
treee5a30eafc99221de336764f6243f7c40ef2debe4 /Python/ast.c
parent653da4f66631403b571786f50f44bff045829853 (diff)
downloadcpython-776d7d68d31c3f5ddeb1e892b9d29252ee352480.tar.gz
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.
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c6
1 files changed, 6 insertions, 0 deletions
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;
}