[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2019-05-16 Thread daniel hahler


daniel hahler  added the comment:

> I think a good alternative patch might be:

This however makes it behave different in tests, where stdout might be 
mocked/wrapped intentionally.

Therefore I think using the parent's `use_rawinput` is the better fix for this 
(the originally proposed patch).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2019-05-16 Thread daniel hahler


daniel hahler  added the comment:

Just for reference and searchability: this causes tab completion to not work 
with `debug foo()` also.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2019-05-16 Thread daniel hahler


daniel hahler  added the comment:

It was added in 477c8d5e702 (a huge svn merge commit), with this reference:


  r45955 | georg.brandl | 2006-05-10 19:13:20 +0200 (Wed, 10 May 2006) | 4 
lines

  Patch #721464: pdb.Pdb instances can now be given explicit stdin and
  stdout arguments, making it possible to redirect input and output
  for remote debugging.

I think a good alternative patch might be:

```diff
 Lib/pdb.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git i/Lib/pdb.py w/Lib/pdb.py
index f5d33c27fc..daf49b3629 100755
--- i/Lib/pdb.py
+++ w/Lib/pdb.py
@@ -141,7 +141,9 @@ def __init__(self, completekey='tab', stdin=None, 
stdout=None, skip=None,
  nosigint=False, readrc=True):
 bdb.Bdb.__init__(self, skip=skip)
 cmd.Cmd.__init__(self, completekey, stdin, stdout)
-if stdout:
+if stdout and stdout is not sys.stdout:
+# stdout gets passed with do_debug for example, but should usually
+# not disable using raw input then.
 self.use_rawinput = 0
 self.prompt = '(Pdb) '
 self.aliases = {}
```

--
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2019-02-27 Thread daniel hahler


daniel hahler  added the comment:

I can confirm that this fixes cursor keys not working properly after "debug 
foo()" (recursive debugging) with pdb.

--
nosy: +blueyed
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2017-07-29 Thread Segev Finer

Changes by Segev Finer :


--
pull_requests: +2996

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2017-07-29 Thread Segev Finer

New submission from Segev Finer:

This is caused by 
https://github.com/python/cpython/blob/caa1280d1ee5f828f346b585169a7592371d3faa/Lib/pdb.py#L1096
 which always passes our own current stdin and stdout, and this triggers the 
conditional in 
https://github.com/python/cpython/blob/caa1280d1ee5f828f346b585169a7592371d3faa/Lib/pdb.py#L144-L145.

self.stdin and self.stdout are initialized to sys.stdin and sys.stdout 
respectively when not passed explicitly: 
https://github.com/python/cpython/blob/caa1280d1ee5f828f346b585169a7592371d3faa/Lib/cmd.py#L87-L94.

See Also: https://github.com/ipython/ipython/pull/10721

--
components: Library (Lib)
messages: 299485
nosy: Segev Finer
priority: normal
severity: normal
status: open
title: pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the 
parent pdb uses rawinput
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com