Message328788
| Author |
orlnub123 |
| Recipients |
orlnub123 |
| Date |
2018年10月29日.04:17:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1540786670.85.0.788709270274.issue35101@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|