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.

This commit is contained in:
Christian Heimes 2008-02-23 15:01:06 +00:00
parent 90c3d9b995
commit 09aaa88328
3 changed files with 9 additions and 1 deletions

View file

@ -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;
}