gh-138641: prevent accessing non-existing curframe in pdb commands#138642
gh-138641: prevent accessing non-existing curframe in pdb commands#138642yihong0618 wants to merge 11 commits intopython:mainfrom yihong0618:hy/inside_pdb_breakpoints_can_crash
curframe in pdb commands#138642Conversation
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
|
If you're not sure if your patch is correct yet or not, let's put it as a draft first. |
picnixz
left a comment
There was a problem hiding this comment.
There are other places where curframe is used such as completedefault. Please check all the places carefully.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
copy will change and open it |
copy will check |
curframe in pdb commands
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
check something others seems not raise error, I will left them |
Signed-off-by: yihong0618 <zouzou0208@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
>>> breakpoint()
> <python-input-0>(1)<module>()
(Pdb) breakpoint()
(Pdb) debug 1>>> breakpoint()
> <python-input-0>(1)<module>()
(Pdb) breakpoint()
(Pdb) break 1And |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
fixed and failed test seems not releate |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
|
careful with another case |
Signed-off-by: yihong0618 <zouzou0208@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com> Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
| # Check if we're already in a pdb session by examining the call stack | ||
| frame = sys._getframe() | ||
| while frame: | ||
| if frame.f_code.co_name == 'interaction' and frame.f_code.co_filename.endswith('pdb.py'): |
There was a problem hiding this comment.
seems can into a function
logic has been changed as per Tian's suggestions
|
I'll bail from shepherding this one as Tian's is the best qualified here. Sorry for the un-necessary work that I made you do! (and thank you for your sponsor ❤️) |
no need~, my English is bad, sorry for that, |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
breakpoint() in pdb the self.curframe will be None
and run something will cause crash
this patch fix it. but not sure if it is worth. if not will close.
pdbcommands may try to access non-existing frames #138641