Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Jul 29, 2017

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 and self.stdout are initialized to sys.stdin and sys.stdout respectively when not passed explicitly: Lib/cmd.py:87-94.

See Also: ipython/ipython#10721

https://bugs.python.org/issue31078

@blueyed
Copy link
Contributor

blueyed commented Feb 15, 2019

This looks like it might fix readline handling with recursive debugging, e.g. cursor keys being displayed as ^[[D? Is this the case?

@segevfiner
Copy link
Contributor Author

This looks like it might fix readline handling with recursive debugging, e.g. cursor keys being displayed as ^[[D? Is this the case?

Maybe, if the underlying issue was that readline wasn't used in recursive debugging. Feel free to try.

@blueyed
Copy link
Contributor

blueyed commented Feb 27, 2019

Yay! \o/

Tested with:

def f():
    pass

import pdb
pdb.set_trace()

And then using debug f() on the pdb prompt.
Arrow keys work properly then with this patch, but not without.

@blueyed
Copy link
Contributor

blueyed commented Feb 27, 2019

@segevfiner
Thanks for this fix.
Please add a news entry for it.
A test would also be awesome, of course - but I cannot say how difficult that is.
(I've also left a comment on https://bugs.python.org/issue31078 to get some attention hopefully)

blueyed added a commit to pdbpp/pdbpp that referenced this pull request Feb 27, 2019
Patch via python/cpython#2947 (bpo-31078).

The test is a bit constructed I guess, but at least something.
blueyed added a commit to pdbpp/pdbpp that referenced this pull request Feb 28, 2019
Patch via python/cpython#2947 (bpo-31078).

No test, since it appears to be hard to simulate cursor keys etc.
@segevfiner segevfiner force-pushed the bpo-31078-recursive-pdb-rawinput branch from a67fdf5 to a2aed1d Compare March 1, 2019 16:36
@segevfiner segevfiner force-pushed the bpo-31078-recursive-pdb-rawinput branch from a2aed1d to abdfb28 Compare March 1, 2019 16:44
@@ -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
Copy link
Contributor

@blueyed blueyed Mar 21, 2019

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)

blueyed added a commit to blueyed/rebased-pdbpp that referenced this pull request May 25, 2019
Patch via python/cpython#2947 (bpo-31078).

No test, since it appears to be hard to simulate cursor keys etc.
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 21, 2022
@segevfiner
Copy link
Contributor Author

segevfiner commented Feb 21, 2022

Refreshed (Bot seems to bug out and leave the PR as stale)...

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Feb 22, 2022
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Mar 24, 2022
@segevfiner
Copy link
Contributor Author

Spam to mark PR fresh...

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Mar 25, 2022
Copy link
Contributor

@MaxwellDupre MaxwellDupre left a 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.

@github-actions
Copy link

github-actions bot commented Jun 7, 2022

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jun 7, 2022
@arhadthedev
Copy link
Member

@arhadthedev arhadthedev changed the title bpo-31078: Propogate use_rawinput to recursive pdb (debug command) gh-75261: Propogate use_rawinput to recursive pdb (debug command) Apr 2, 2023
@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Apr 2, 2023
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Apr 3, 2023
@github-actions
Copy link

github-actions bot commented May 3, 2023

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label May 3, 2023
@segevfiner
Copy link
Contributor Author

Bump No. 5

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label May 4, 2023
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jun 8, 2023
@segevfiner
Copy link
Contributor Author

Bump No. 6

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jun 9, 2023
@github-actions
Copy link

github-actions bot commented Jul 9, 2023

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jul 9, 2023
@segevfiner
Copy link
Contributor Author

Bump No. 7

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jul 10, 2023
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Aug 10, 2023
@segevfiner
Copy link
Contributor Author

Bump No. 8

Copy link
Member

@iritkatriel iritkatriel left a 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.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Aug 11, 2023
@ambv
Copy link
Contributor

ambv commented Aug 11, 2023

Closing and re-opening to retrigger CLA checks. Sorry for the noise.

@ambv ambv closed this Aug 11, 2023
@ambv ambv reopened this Aug 11, 2023
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes stale Stale PR or inactive for long period of time. stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants