Message91541
inspect.getsource(obj) returns incorrect results when obj is a
traceback or frame object outside any function (that is, at the module
level).
This demo script shows the problem. The correct output should contain
all source lines in the module, but it only returns the first two:
D:\temp>type show_inspect_bug.py
def foo(x):
return y + z
import inspect
frame = inspect.currentframe()
print inspect.getsource(frame)
D:\temp>python show_inspect_bug.py
def foo(x):
return y + z
The attached patch fixes the problem and adds some missing test cases.
Originally reported by Juanjo Conti at the local Python group. |
|
Date |
User |
Action |
Args |
2009-08-14 04:19:22 | ggenellina | set | recipients:
+ ggenellina |
2009-08-14 04:19:22 | ggenellina | set | messageid: <1250223562.74.0.274098839265.issue6700@psf.upfronthosting.co.za> |
2009-08-14 04:19:21 | ggenellina | link | issue6700 messages |
2009-08-14 04:19:20 | ggenellina | create | |
|