[issue17735] inspect.findsource throws IndexError

Kyle Simpson report at bugs.python.org
Mon Apr 15 14:52:20 CEST 2013


New submission from Kyle Simpson:

Here is one way to reproduce this bug:

1. Create a module file (bug.py in this example)

def func():
    pass

2. Run Python

>>> import bug
>>> help(bug)

3. Edit bug.py

def func():
    pass

def newfunc():
    pass

4. Use the same Python interpreter as in step 2

>>> reload(bug)
>>> help(bug)

5. Observe traceback

  [..snip..]
  File "C:\Python27\lib\inspect.py", line 578, in findsource
    if pat.match(lines[lnum]): break
IndexError: list index out of range


Note: A related but different issue is http://bugs.python.org/issue1218234.

----------
components: Library (Lib)
messages: 186983
nosy: Kyle.Simpson
priority: normal
severity: normal
status: open
title: inspect.findsource throws IndexError
type: behavior
versions: Python 2.7, Python 3.3

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


More information about the Python-bugs-list mailing list