summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-30 03:17:24 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-30 03:17:24 (GMT)
commit1b145927d725b136b987df220dff0ec7529b6f29 (patch)
treea597728e07ca0af44f923c7f056aec396f61e784 /Lib/inspect.py
parent9098472299a18471f29b3ed471376be2d29178be (diff)
downloadcpython-1b145927d725b136b987df220dff0ec7529b6f29.zip
cpython-1b145927d725b136b987df220dff0ec7529b6f29.tar.gz
cpython-1b145927d725b136b987df220dff0ec7529b6f29.tar.bz2
#17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 7a7bb91..7834d12 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -550,7 +550,7 @@ def findsource(object):
file = getfile(object)
sourcefile = getsourcefile(object)
- if not sourcefile and file[0] + file[-1] != '<>':
+ if not sourcefile and file[:1] + file[-1:] != '<>':
raise IOError('source code not available')
file = sourcefile if sourcefile else file