-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-138641: prevent accessing non-existing curframe
in pdb commands
#138642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
gh-138641: prevent accessing non-existing curframe
in pdb commands
#138642
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 1 And |
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>
Lib/pdb.py
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
pdb
commands may try to access non-existing frames #138641