-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
gh-75261: Propogate use_rawinput to recursive pdb (debug command) #2947
base: main
Are you sure you want to change the base?
gh-75261: Propogate use_rawinput to recursive pdb (debug command) #2947
Conversation
This looks like it might fix readline handling with recursive debugging, e.g. cursor keys being displayed as |
Maybe, if the underlying issue was that readline wasn't used in recursive debugging. Feel free to try. |
Yay! \o/ Tested with: def f():
pass
import pdb
pdb.set_trace() And then using |
@segevfiner |
Patch via python/cpython#2947 (bpo-31078). The test is a bit constructed I guess, but at least something.
Patch via python/cpython#2947 (bpo-31078). No test, since it appears to be hard to simulate cursor keys etc.
a67fdf5
to
a2aed1d
Compare
a2aed1d
to
abdfb28
Compare
@@ -1100,6 +1100,7 @@ def do_debug(self, arg): | |||
self.error(traceback.format_exception_only(*exc_info)[-1].strip()) | |||
return | |||
p = Pdb(self.completekey, self.stdin, self.stdout) | |||
p.use_rawinput = self.use_rawinput |
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.
Could have a comment that this is required because "stdout" is passed.
As for a test, you could inspect frames (similar to pdbpp/pdbpp#169), but not sure if that is really useful / worth it.
(I just came across this again, after having backported it to pdbpp not correctly before - and wrote a test then.. ;) ref)
Patch via python/cpython#2947 (bpo-31078). No test, since it appears to be hard to simulate cursor keys etc.
This PR is stale because it has been open for 30 days with no activity. |
Refreshed (Bot seems to bug out and leave the PR as |
This PR is stale because it has been open for 30 days with no activity. |
Spam to mark PR fresh... |
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.
Ran test_pdb:
Ran 57 tests in 8.767s
OK
Looks ok.
This PR is stale because it has been open for 30 days with no activity. |
This PR is stale because it has been open for 30 days with no activity. |
Bump No. 5 |
This PR is stale because it has been open for 30 days with no activity. |
Bump No. 6 |
This PR is stale because it has been open for 30 days with no activity. |
Bump No. 7 |
This PR is stale because it has been open for 30 days with no activity. |
Bump No. 8 |
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.
A functional change such as this should be committed with a unit test that fails without the change.
Unit tests are important to (1) prevent regression, and (2) clarify what is being changed.
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 |
Closing and re-opening to retrigger CLA checks. Sorry for the noise. |
This PR is stale because it has been open for 30 days with no activity. |
This is caused by Lib/pdb.py:1096 which always passes our own current stdin and stdout, and this triggers the conditional in Lib/pdb.py:144-145.
self.stdin
andself.stdout
are initialized tosys.stdin
andsys.stdout
respectively when not passed explicitly: Lib/cmd.py:87-94.See Also: ipython/ipython#10721
https://bugs.python.org/issue31078