Message328788
If you pass a frame object belonging to a class into findsource, it'll incorrectly give you the starting line number of the first function above it or 0 if no functions are defined.
Here's some code to reproduce the issue:
import inspect
def test_func():
... # This should not get printed
class Test:
frame = inspect.currentframe()
print(inspect.getsource(Test.frame)) # Depends on findsource
This unexpectedly prints the source of test_func instead of the class right below it. |
|
| Date |
User |
Action |
Args |
| 2018-10-29 04:17:50 | orlnub123 | set | recipients:
+ orlnub123 |
| 2018-10-29 04:17:50 | orlnub123 | set | messageid: <1540786670.85.0.788709270274.issue35101@psf.upfronthosting.co.za> |
| 2018-10-29 04:17:50 | orlnub123 | link | issue35101 messages |
| 2018-10-29 04:17:50 | orlnub123 | create | |
|