[Python-bugs-list] [ python-Bugs-832535 ] Inconsitent line
numbering in traceback
SourceForge.net
noreply at sourceforge.net
Mon Nov 3 06:59:15 EST 2003
Bugs item #832535, was opened at 2003-10-29 17:48
Message generated for change (Comment added) made by mwh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=832535&group_id=5470
Category: IDLE
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Kirby Urner (urnerk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Inconsitent line numbering in traceback
Initial Comment:
Transcript below documents the problem.
A traceback shows a line with no float() op, but
complains of a float op error.
I restart the shell, with no changes to the imported
module, and this time line 45 is correctly listed.
>>> reload(brawley)
<module 'brawley' from 'C:\Documents and
Settings\Kirby\My
Documents\FreeGeek\PythonicGeom\brawley.py'>
>>> brawley.test2()
elems: 3, 4, 5, 0.5, 'White',
sublist: 7,8,9]
['3', ' 4', ' 5', ' 0.5', " 'White'", ' ']
['3', ' 4', ' 5', ' 0.5', " 'White'"]
Traceback (most recent call last):
File "<pyshell#28>", line 1, in -toplevel-
brawley.test2()
File "C:\Documents and Settings\Kirby\My
Documents\FreeGeek\PythonicGeom\brawley.py", line
45, in test2
color = elems[-2]
ValueError: invalid literal for float(): 'White
>>> ================================
RESTART ================================
>>> import brawley
>>> brawley.test2()
elems: 3, 4, 5, 0.5, 'White',
sublist: 7,8,9]
['3', ' 4', ' 5', ' 0.5', " 'White'", ' ']
['3', ' 4', ' 5', ' 0.5', " 'White'"]
Traceback (most recent call last):
File "<pyshell#30>", line 1, in -toplevel-
brawley.test2()
File "C:\Documents and Settings\Kirby\My
Documents\FreeGeek\PythonicGeom\brawley.py", line
45, in test2
x,y,z,radius = [float(i) for i in elems[:-3].split(',')]
ValueError: invalid literal for float(): 'White
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2003-11-03 11:59
Message:
Logged In: YES
user_id=6656
If by reload you mean the builtin function reload(), the
answer is probably because that would be a bitch to arrange
(have you ever looked at the import code? scares me more
than most other in Python). Could be done, though, and is
perhaps the right answer. Other answers would be having
traceback.py not use linecache or deprecating and doing away
with linecache entirely.
----------------------------------------------------------------------
Comment By: Jeremy Fincher (jemfinch)
Date: 2003-10-31 19:41
Message:
Logged In: YES
user_id=99508
Yeah, this is definitely the linecache problem. Is there a
good reason why reload doesn't do a linecache.checkcache
itself? I really doubt reload is being called inside
performance-sensitive code.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2003-10-29 18:02
Message:
Logged In: YES
user_id=6656
Is this the hoary old "being lied to by linecache" thing? I
complain about that every now and again, but haven't
actually done anything about it yet...
----------------------------------------------------------------------
Comment By: Kirby Urner (urnerk)
Date: 2003-10-29 17:56
Message:
Logged In: YES
user_id=191709
It's a little more serious. After a save/reload, the traceback
will echo code that's no longer present in the source at all.
Traceback (most recent call last):
File "<pyshell#34>", line 1, in -toplevel-
brawley.test2()
File "C:\Documents and Settings\Kirby\My
Documents\FreeGeek\PythonicGeom\brawley.py", line 45, in
test2
x,y,z,radius = [float(i) for i in elems[:-3].split(',')]
ValueError: invalid literal for float(): 'White'
But line 45 in the saved/reloaded source is really:
x,y,z,radius = [float(i) for i in elems.split(',')[:-1]]
When I restart the shell and import, the real source code is
echoed.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=832535&group_id=5470
More information about the Python-bugs-list
mailing list