<div dir="ltr">Hello,<br><br>I've been tinkering with __code__.co_firstlineno for testing the trace.py module (Python Issue 9315), and ran into an interesting problem. Consider this code:<br><br><br>def dummydecorator(f):<br>

    return f<br><br>def foo(a):<br>    return a<br><br>@dummydecorator<br>def bar(a):<br>    return a <br><br><br>if __name__ == "__main__":<br>    print foo.__code__.co_firstlineno<br>    print bar.__code__.co_firstlineno<br>

<br>----<br>The first print out correctly specifies the line "def foo" is in. However, the second one points to the line with "@dummydecorator" instead of "def bar". [Python 2.6]<br><br>The side-effects of this behavior can be easily seen in the output of modules like trace and profile. Would you say it's normal, or could this be considered a bug?<br>

<br>Eli<br><br></div>