mirror of https://github.com/python/cpython.git
Tweak the tb_lineno() function to be compatible with JPython, which
has no line number table etc.
This commit is contained in:
parent
50b3eb6a9e
commit
7266496b00
|
@ -188,10 +188,14 @@ def extract_stack(f=None, limit = None):
|
||||||
# in compile.c.
|
# in compile.c.
|
||||||
|
|
||||||
def tb_lineno(tb):
|
def tb_lineno(tb):
|
||||||
c = tb.tb_frame.f_code
|
f = tb.tb_frame
|
||||||
tab = c.co_lnotab
|
try:
|
||||||
line = c.co_firstlineno
|
c = f.f_code
|
||||||
stopat = tb.tb_lasti
|
tab = c.co_lnotab
|
||||||
|
line = c.co_firstlineno
|
||||||
|
stopat = tb.tb_lasti
|
||||||
|
except AttributeError:
|
||||||
|
return f.f_lineno
|
||||||
addr = 0
|
addr = 0
|
||||||
for i in range(0, len(tab), 2):
|
for i in range(0, len(tab), 2):
|
||||||
addr = addr + ord(tab[i])
|
addr = addr + ord(tab[i])
|
||||||
|
|
Loading…
Reference in New Issue