Irit Katriel <[email protected]> added the comment:
I think this was fixed by now:
I changed the script to print the result:
******************************************
import inspect, sys
# /etc/hostname is one line, but our source has multiple lines
code = compile('\n\n\n1/0', '/etc/hostname', 'exec')
try:
exec(code, {})
except Exception:
tb = sys.exc_info()[2]
else:
assert False, "unreachable, exec should always raise exception"
# this fails with an IndexError
print(inspect.getinnerframes(tb))
******************************************
and I got this output:
C:\Users\User\src\cpython>python.bat x.py
Running Release|Win32 interpreter...
[FrameInfo(frame=<frame at 0x01140DF0, file
'C:\\Users\\User\\src\\cpython\\x.py', line 14, code <module>>,
filename='C:\\Users\\User\\src\\cpython\\x.py', lineno=7, function='<module>',
code_context=[' exec(code, {})\n'], index=0), FrameInfo(frame=<frame at
0x011CA758, file '/etc/hostname', line 4, code <module>>,
filename='/etc/hostname', lineno=4, function='<module>', code_context=None,
index=None)]
----------
nosy: +iritkatriel
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue15128>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com