This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: stdin argument to pdb.Pdb doesn't work unless you also set Pdb.use_rawinput = False
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: can cmd.py's API/docs for the use of an alternate stdin be improved?
View: 2571
Assigned To: Nosy List: docs@python, eric.araujo, hoffman, r.david.murray
Priority: normal Keywords: patch

Created on 2010-11-12 17:50 by hoffman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testcase.py hoffman, 2010-11-12 17:50 test case demonstrating how stdin argument is without effect
expected_behavior.py hoffman, 2010-11-12 17:51 test case demonstrating expected behavior when use_rawinput = False
Messages (6)
msg121050 - (view) Author: Michael Hoffman (hoffman) Date: 2010-11-12 17:50
If you create a Pdb instance with an stdin argument, the default behavior is for commands to be retrieved using raw_input(), which uses sys.stdin instead, thereby causing the stdin argument to be without effect.

You can work around this by setting the use_rawinput attribute of the instance to False, but this should be done whenever an stdin argument is given to the constructor.
msg121109 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-11-13 04:22
This is a duplicate of issue 2571.  If after reading that discussion you have ideas about and interest in working on the feature request as suggested, you may either comment on that one or open a new feature request, whichever seems clearer to you.

Note that the pdb docs direct you the cmd docs, which clearly document the need to set use_rawinput, so this is not even a doc bug.
msg121148 - (view) Author: Michael Hoffman (hoffman) Date: 2010-11-13 18:13
As always, it seems a bit more complicated than I originally expected. Since it's too late for a Python 2.x feature addition, I'll wait until I upgrade to 3.x to work on that.

You are correct, technically this is not a docs bug but I think the clarity of the docs would be greatly improved if you would add the text from the cmd module docs to the pdb docs:

"If you want a given stdin to be used, make sure to set the instance’s use_rawinput attribute to False, otherwise stdin will be ignored."

I hope you will agree that this is unexpected behavior that doesn't really fit into the zen of Python.
msg121542 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-19 15:44
+1 on clarifying the docs.  Michael, where in the file do you think it should go?  (You can also directly make a diff if you want.)
msg121552 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-11-19 16:52
The argument against adding this to the pdb docs is that if you pull in that statement from cmd, you really ought to pull in the full description of the __init__ arguments. And whether you do that or just pull in that single statement, you are duplicating the documentation from cmd.  This *may* be best, but it does increase the maintenance burden, since any change to cmd will require changes to both the cmd and pdb docs, whereas now someone changing cmd doesn't need to know that they also have to update pdb.  If the situation being documented here improves in some way, I'll bet we will forget to update the pdb docs accordingly....

So, I'm -1 on adding this to the pdb docs, but will bow to the wisdom of the doc folks :)
msg121553 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-19 17:02
This is a sound argument.  I had also missed your comment “Note that the pdb docs direct you the cmd docs, which clearly document the need to set use_rawinput, so this is not even a doc bug”, which I was about to write with other words :)  There was actually no need to reopen this bug.
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54605
2010-11-19 17:02:45eric.araujosetstatus: open -> closed

components: + Library (Lib), - Documentation
assignee: docs@python ->
messages: + msg121553
superseder: can cmd.py's API/docs for the use of an alternate stdin be improved?
resolution: duplicate
stage: patch review -> resolved
2010-11-19 16:52:31r.david.murraysetmessages: + msg121552
2010-11-19 15:44:37eric.araujosetstatus: closed -> open

resolution: duplicate -> (no value)

assignee: docs@python
keywords: + patch
stage: resolved -> patch review
versions: + Python 3.1, Python 3.2
nosy: + docs@python, eric.araujo
messages: + msg121542
components: + Documentation, - Library (Lib)
superseder: can cmd.py's API/docs for the use of an alternate stdin be improved? -> (no value)
2010-11-13 18:13:16hoffmansetmessages: + msg121148
2010-11-13 06:58:00georg.brandlsetstatus: open -> closed
2010-11-13 04:22:15r.david.murraysetnosy: + r.david.murray
messages: + msg121109
resolution: duplicate

superseder: can cmd.py's API/docs for the use of an alternate stdin be improved?
stage: resolved
2010-11-12 17:51:12hoffmansetfiles: + expected_behavior.py
2010-11-12 17:50:18hoffmancreate