[issue16103] Help() fails at raw_input readline (IDLE 2.7.3, Win7, pythonw)

Terry J. Reedy report at bugs.python.org
Mon Oct 1 22:01:13 CEST 2012


New submission from Terry J. Reedy:

Problem is only 2.7.3 (not 3.2.3, 3.3.0), tested on Windows

Command Line Window
>>> help()
...
help> _

The _ is blinking, waiting for input.

IDLE Shell
>>> help()
...
help> 
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    help()
  File "C:\Programs\Python27\lib\site.py", line 467, in __call__
    return pydoc.help(*args, **kwds)
  File "C:\Programs\Python27\lib\pydoc.py", line 1750, in __call__
    self.interact()
  File "C:\Programs\Python27\lib\pydoc.py", line 1762, in interact
    request = self.getline('help> ')
  File "C:\Programs\Python27\lib\pydoc.py", line 1773, in getline
    return raw_input(prompt)
UnsupportedOperation: readline

There is no blinking _, at that is from the raw_input() call that failed. There is no problem with help() in IDLE for 3.2, 3.3.

I see two possibilities:
1. This has nothing to do with Idle directly, but is a problem with pythonw and raw_input/readline that was later fixed.
2. This is a result of how stdin is proxied by Idle and that there is a difference between 2.7 and 3.x.

builtin_raw_input in bltinmodule.c calls
  s = PyOS_Readline(PyFile_AsFile(fin), PyFile_AsFile(fout), prompt);
and I presume PyOS_Readline eventually calls fin.readline()

UnsupportedOperation is defined (in 2.7, at least) in _pyio.py
_pyio._unsupported(self, name) raises it with names.
That in turn is the default body for every operation. In particular,
    def readline(self):
        self._unsupported("readline")

So I presume 2. is the problem and the proxy in the pythonw process is an io subclass that needs readline defined for help() to work.
(Is proxying same on all OSes? Or would problem be Windows only?)

----------
components: IDLE, Windows
messages: 171743
nosy: serwy, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Help() fails at raw_input readline (IDLE 2.7.3, Win7, pythonw)
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16103>
_______________________________________


More information about the Python-bugs-list mailing list