diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-23 15:01:06 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-23 15:01:06 (GMT) |
commit | 09aaa88328a5083469b2682230c7f3c62942afab (patch) | |
tree | 5574f715c55f9287b78af484989160d11821fef3 /Python/ast.c | |
parent | 90c3d9b99563abebbd0737c711be1c9313c1547b (diff) | |
download | cpython-09aaa88328a5083469b2682230c7f3c62942afab.zip cpython-09aaa88328a5083469b2682230c7f3c62942afab.tar.gz cpython-09aaa88328a5083469b2682230c7f3c62942afab.tar.bz2 |
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.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 97486c5..8b68182 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; } |