GH-103319: Fix inspect.getsourcelines() to return 1-based line numbers#103226
GH-103319: Fix inspect.getsourcelines() to return 1-based line numbers#103226artemmukhin wants to merge 2 commits into
inspect.getsourcelines() to return 1-based line numbers#103226Conversation
Sorry, something went wrong.
|
@iritkatriel Could you please take a look, as this is a follow-up to #101674 you already reviewed? |
Sorry, something went wrong.
|
1-based does seem more reasonable. But if we are fixing this, how about the code in |
Sorry, something went wrong.
The bug in pdb that you describe in the issue may be new, but you are changing behaviour of inspect in the PR. Question is whether this is a bug in inspect. |
Sorry, something went wrong.
|
The doc of I would think this as a bug, but it's true that this is a breaking behavior. If we kept it as it is in |
Sorry, something went wrong.
|
If there's a fix in pdb that you can do so we don't release a new bug there, then let's do it. Changing inspect probably would require more discussion. FYI @Yhg1s . |
Sorry, something went wrong.
|
@iritkatriel Thank you for the quick response. That sounds reasonable. I can create a separate issue regarding @gaogaotiantian Thanks for pointing |
Sorry, something went wrong.
|
@iritkatriel @gaogaotiantian I have opened a new issue regarding |
Sorry, something went wrong.
inspect.getsourcelines() to return 1-based line numbers|
A solution may be to change the documentation, rather than the result, so that existing code does not break. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
The problem is described in GH-103225.
I did not find any other usages of a line number returned by
inspect.getsourcelines()except forpdb. However, I am not sure how many external usages ofinspect.getsourcelines()already rely on 0-based line numbers for modules.inspect.{getsourcelines, findsource}return 0 as the starting line number for modules #103319