[issue15128] inspect raises exception when frames are misleading about source line numbers

2020-11-03 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15128] inspect raises exception when frames are misleading about source line numbers

2020-09-18 Thread Irit Katriel


Irit Katriel  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=>, 
filename='C:\\Users\\User\\src\\cpython\\x.py', lineno=7, function='', 
code_context=['exec(code, {})\n'], index=0), FrameInfo(frame=>, 
filename='/etc/hostname', lineno=4, function='', code_context=None, 
index=None)]

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15128] inspect raises exception when frames are misleading about source line numbers

2013-02-24 Thread Jyrki Pulliainen

Jyrki Pulliainen added the comment:

Use of IOError might be a bit problematic. The find  get return IOError if 
they can't find the source, but for mismatch if the line is not found is not to 
me an IOError.

Btw, to be able to merge your patch, you need to sign the contributor agreement 
in here: http://www.python.org/psf/contrib/contrib-form-python/

--
nosy: +nailor

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15128] inspect raises exception when frames are misleading about source line numbers

2012-06-21 Thread Kevin M. Turner

New submission from Kevin M. Turner acapno...@users.sourceforge.net:

The attached example shows how inspect.findsource fails when given a stack 
frame that points to a non-existent source line, and how inspect.getframeinfo 
and getinnerframes do not handle that failure.

On the one hand, yes, this code was asking for it by building such a broken 
frame.  On the other hand, having code that examines tracebacks result in 
tracebacks of its own sucks a whole bunch.

The inspect findget source methods are documented as returning IOError if they 
cannot find the source, and the calling code handles that case, so that's 
probably what should happen here.

(Actually, that seems straightforward enough, I can make a patch for that 
shortly.)

This may help with issue #1628987 as well.

--
components: Library (Lib)
files: inspectLineNumber.py
messages: 163355
nosy: acapnotic
priority: normal
severity: normal
status: open
title: inspect raises exception when frames are misleading about source line 
numbers
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file26073/inspectLineNumber.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15128] inspect raises exception when frames are misleading about source line numbers

2012-06-21 Thread Kevin M. Turner

Kevin M. Turner acapno...@users.sourceforge.net added the comment:

patch attached (against python 2.7 tip)

--
keywords: +patch
Added file: http://bugs.python.org/file26077/15128-inspect-source-linenum.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com