Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd54069 commit b910efeCopy full SHA for b910efe
1 file changed
Lib/inspect.py
@@ -305,10 +305,10 @@ def getcomments(object):
305
if ismodule(object):
306
# Look for a comment block at the top of the file.
307
start = 0
308
- if lines[0][:2] == '#!': start = 1
+ if lines and lines[0][:2] == '#!': start = 1
309
while start < len(lines) and string.strip(lines[start]) in ['', '#']:
310
start = start + 1
311
- if lines[start][:1] == '#':
+ if start < len(lines) and lines[start][:1] == '#':
312
comments = []
313
end = start
314
while end < len(lines) and lines[end][:1] == '#':
0 commit comments