This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2018年10月29日 04:17 by orlnub123, last changed 2022年04月11日 14:59 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 10209 | open | orlnub123, 2018年10月29日 04:20 | |
| Messages (3) | |||
|---|---|---|---|
| msg328788 - (view) | Author: (orlnub123) * | Date: 2018年10月29日 04:17 | |
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. |
|||
| msg328800 - (view) | Author: Karthikeyan Singaravelan (xtreak) * (Python committer) | Date: 2018年10月29日 10:57 | |
Seems there is a related open issue with a similar regex based solution proposed for another class definition related issue : https://bugs.python.org/issue22355#msg226538 . I think it's worth converting the example code reported in issue22355 as unit test cases. Since this issue already has a PR with tests then we can proceed further on this. Thanks for the report! |
|||
| msg329033 - (view) | Author: (orlnub123) * | Date: 2018年11月01日 01:54 | |
Added the requested test cases. They aren't an exact match but they should serve the same purpose. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:07 | admin | set | github: 79282 |
| 2019年01月26日 06:52:01 | Aivar.Annamaa | set | nosy:
+ Aivar.Annamaa |
| 2018年11月01日 01:54:38 | orlnub123 | set | messages: + msg329033 |
| 2018年10月29日 10:57:47 | xtreak | set | messages: + msg328800 |
| 2018年10月29日 09:11:30 | xtreak | set | nosy:
+ yselivanov, xtreak |
| 2018年10月29日 04:20:11 | orlnub123 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request9527 |
| 2018年10月29日 04:17:50 | orlnub123 | create | |