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: code.InteractiveConsole() and closed sys.stdout
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, ajaksu2
Priority: low Keywords: easy, patch

Created on 2006-09-21 18:53 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
code.diff skip.montanaro, 2006-09-27 10:46
Messages (4)
msg29905 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2006-09-21 18:53
This code raises a ValueError:

  import code
  c = code.InteractiveConsole()
  c.interact()
  import sys
  sys.stdout.close()

because the InteractiveConsole uses raw_input() to
display its prompt.  I'm not sure where the correct
place to fix this is.  One possible way is to allow
raw_input() to take optional arguments to use instead
of sys.stdin and sys.stdout.  Another (easier?) way
to fix this problem might be to beef up
InteractiveConsole.raw_input() a bit.  I'm open to
either option, but I think InteractiveConsole needs
to continue working even if the user closes
sys.stdout.

This applies to the 2.4 and 2.5 branches as well as
the trunk.

msg29906 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2006-09-27 10:46
Logged In: YES 
user_id=44345

Here's a plausible (I think) patch for code.InteractiveConsole.
msg84463 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-03-30 02:33
Confirmed on trunk, works fine on py3k.
msg114822 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-24 20:42
Works fine on 2.7 and py3k.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44006
2010-08-24 20:42:51BreamoreBoysetstatus: open -> closed

nosy: + BreamoreBoy
messages: + msg114822

resolution: out of date
2010-05-20 20:28:06skip.montanarosetnosy: - skip.montanaro
2009-03-30 02:33:01ajaksu2setpriority: normal -> low

type: behavior
versions: + Python 2.6
keywords: + patch, easy
nosy: + ajaksu2

messages: + msg84463
stage: test needed
2006-09-21 18:53:14skip.montanarocreate