[issue2832] Line numbers reported by extract_stack are offset by the #-*- encoding line

Dmitry Dvoinikov report at bugs.python.org
Mon May 12 06:52:05 CEST 2008


New submission from Dmitry Dvoinikov <dmitry at targeted.org>:

Stack trace information extracted with traceback.extract_stack is
incorrect in that the #-*- line causes double counting. For example:

#comment
from traceback import extract_stack
print("this is line", extract_stack()[-1][1])

prints 'this is line 3', but

#comment
#-*- coding: windows-1251 -*-
from traceback import extract_stack
print("this is line", extract_stack()[-1][1])

prints 'this is line 6'

----------
components: Library (Lib)
messages: 66708
nosy: ddvoinikov
severity: normal
status: open
title: Line numbers reported by extract_stack are offset by the #-*- encoding line
type: behavior
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2832>
__________________________________


More information about the Python-bugs-list mailing list