[issue11709] help-method crashes if sys.stdin is None

Jessica McKellar report at bugs.python.org
Sun Apr 27 08:41:54 CEST 2014


Jessica McKellar added the comment:

Thanks for reporting this, palm.kevin, and thanks for the patch, amaury.forgeotdarc.

First, just to be explicit here's a short reproducer:

  import sys
  
  sys.stdin = None
  help(1)

(Note that to get to the isatty check you need to provide an argument and it has to be something that has help, so `help()` and `help("a")` don't exercise this code path)

Also, here is where sys.stdin can be set to None:

http://hg.python.org/cpython/file/dbceba88b96e/Python/pythonrun.c#l1201

The provided patch fixes the above test case; instead of erroring out with the traceback in the original bug report, the plain pager is used and the help message is printed to stdout.

Anyone on the nosy list interested in writing some tests?

----------
nosy: +jesstess
stage: patch review -> test needed
versions: +Python 3.5 -Python 3.2

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


More information about the Python-bugs-list mailing list