summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-08-15 14:59:02 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-08-15 14:59:02 (GMT)
commitdd32a91cc0c8ba178d7ee5e78c30b6920aff66f4 (patch)
tree1a2062b54d3445ca788fd63c2bc63984dd85f34a /Lib/traceback.py
parentadd88060c1d1a98c7970e35b326e6a65a17ddf04 (diff)
downloadcpython-dd32a91cc0c8ba178d7ee5e78c30b6920aff66f4.zip
cpython-dd32a91cc0c8ba178d7ee5e78c30b6920aff66f4.tar.gz
cpython-dd32a91cc0c8ba178d7ee5e78c30b6920aff66f4.tar.bz2
This is my patch
[ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py27
1 files changed, 5 insertions, 22 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index c22f576..4910a37 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -59,7 +59,7 @@ def print_tb(tb, limit=None, file=None):
n = 0
while tb is not None and (limit is None or n < limit):
f = tb.tb_frame
- lineno = tb_lineno(tb)
+ lineno = tb.tb_lineno
co = f.f_code
filename = co.co_filename
name = co.co_name
@@ -92,7 +92,7 @@ def extract_tb(tb, limit = None):
n = 0
while tb is not None and (limit is None or n < limit):
f = tb.tb_frame
- lineno = tb_lineno(tb)
+ lineno = tb.tb_lineno
co = f.f_code
filename = co.co_filename
name = co.co_name
@@ -263,7 +263,7 @@ def extract_stack(f=None, limit = None):
list = []
n = 0
while f is not None and (limit is None or n < limit):
- lineno = f.f_lineno # XXX Too bad if -O is used
+ lineno = f.f_lineno
co = f.f_code
filename = co.co_filename
name = co.co_name
@@ -279,23 +279,6 @@ def extract_stack(f=None, limit = None):
def tb_lineno(tb):
"""Calculate correct line number of traceback given in tb.
- Even works with -O on.
+ Obsolete in 2.3.
"""
- # Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line()
- # in compile.c.
- # Revised version by Jim Hugunin to work with JPython too.
-
- c = tb.tb_frame.f_code
- if not hasattr(c, 'co_lnotab'):
- return tb.tb_lineno
-
- tab = c.co_lnotab
- line = c.co_firstlineno
- stopat = tb.tb_lasti
- addr = 0
- for i in range(0, len(tab), 2):
- addr = addr + ord(tab[i])
- if addr > stopat:
- break
- line = line + ord(tab[i+1])
- return line
+ return tb.tb_lineno