| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hi @iritkatriel , do you have some time to take a look at this PR? Basically this tries to locate the first line of the function when the user break on a function that is not complied yet so the line number of the breakpoint would be correct. |
Sorry, something went wrong.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
…on when using `break func` in pdb (python#112470)
| Back | FazBrowse Home | New Git URL |
In #110582, we made break foo work if foo is already a known function (that has an associated code object). However, if foo is in another module or it's not defined yet, we still use regular expression to find the definition, which will still set the breakpoint on the def line. This is an inconsistent behavior and will confuse users because the actual break will be on the first executable line.
This PR solves the issue by trying to compile the head of function to find the first executable line. As long as the first couple of lines are compilable, we should be able to find the first executable line of the function and set the break point on it. This skips comments, empty lines well (and not using pure strings to figure it out).
Notably, this is a breaking change - because the previous behavior is confusing.