Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 45448:f1b50aa5d5af
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.
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sat, 23 Feb 2008 15:01:06 +0000 |
| parents | fa2f7183b1af |
| children | 832c820e9d14 |
line wrap: on
line diff
--- a/Python/ast.c Sat Feb 23 13:18:03 2008 +0000 +++ b/Python/ast.c Sat Feb 23 15:01:06 2008 +0000 @@ -1015,6 +1015,12 @@ } 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; }
