summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-30 05:10:28 +0200
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-30 05:10:28 +0200
commite66e7de5d69542d9f10010a83787ef4b87a70bf8 (patch)
treead2c3abd8422c8ecf41414e62f5c0e51ba63e7dc /Lib/inspect.py
parentf03aab7e519b2c801b193907086f064867ef53c1 (diff)
downloadcpython-git-e66e7de5d69542d9f10010a83787ef4b87a70bf8.tar.gz
#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 66d5186573..9e928b294f 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -525,7 +525,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