[New-bugs-announce] [issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

Elias Vanderstuyft report at bugs.python.org
Mon Jan 23 16:50:38 EST 2017

New submission from Elias Vanderstuyft:

The following might be either a bug in the pydoc module or in the inspect module:

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydoc
>>> pydoc.help(lambda (a,): lambda x: a)    # this fails
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/pydoc.py", line 1797, in __call__
  File "/usr/lib/python2.7/pydoc.py", line 1844, in help
    else: doc(request, 'Help on %s:')
  File "/usr/lib/python2.7/pydoc.py", line 1581, in doc
    pager(render_doc(thing, title, forceload))
  File "/usr/lib/python2.7/pydoc.py", line 1576, in render_doc
    return title % desc + '\n\n' + text.document(object, name)
  File "/usr/lib/python2.7/pydoc.py", line 363, in document
    if inspect.isroutine(object): return self.docroutine(*args)
  File "/usr/lib/python2.7/pydoc.py", line 1321, in docroutine
    args, varargs, varkw, defaults = inspect.getargspec(object)
  File "/usr/lib/python2.7/inspect.py", line 817, in getargspec
    args, varargs, varkw = getargs(func.func_code)
  File "/usr/lib/python2.7/inspect.py", line 791, in getargs
    args[i] = stack[0]
IndexError: list index out of range
>>> pydoc.help(lambda (a,): lambda x: x)    # this succeeds


components: Library (Lib)
messages: 286119
nosy: Elias Vanderstuyft
priority: normal
severity: normal
status: open
title: Python 2.7.12: pydoc.help(lambda (a,): lambda x: a) raises IndexError
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list