[Python-bugs-list] [ python-Bugs-767794 ] invalid break in function definition from shell acts funny

SourceForge.net noreply@sourceforge.net
Tue, 08 Jul 2003 10:38:16 -0700


Bugs item #767794, was opened at 2003-07-08 09:38
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=767794&group_id=5470

Category: IDLE
Group: Python 2.2.3
Status: Open
Resolution: None
>Priority: 6
Submitted By: Lloyd Hugh Allen (lha2)
Assigned to: Kurt B. Kaiser (kbk)
Summary: invalid break in function definition from shell acts funny

Initial Comment:
the following function definition, typed in at an idle 
prompt:

def broken():
	print "function"
	break
===
gives the traceback
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python22\lib\lib-tk\Tkinter.py", line 1316, in 
__call__
    return apply(self.func, args)
  File "C:\Python22\Tools\idle\PyShell.py", line 595, in 
enter_callback
    self.runit()
  File "C:\Python22\Tools\idle\PyShell.py", line 614, in 
runit
    more = self.interp.runsource(line)
  File "C:\Python22\Tools\idle\PyShell.py", line 192, in 
runsource
    return InteractiveInterpreter.runsource(self, source, 
filename)
  File "C:\Python22\lib\code.py", line 79, in runsource
    self.showsyntaxerror(filename)
  File "C:\Python22\Tools\idle\PyShell.py", line 219, in 
showsyntaxerror
    pos = "iomark linestart + %d lines + %d chars" % 
(lineno-1,
TypeError: unsupported operand type(s) for -
: 'NoneType' and 'int'

===
above the function definition. Alt-P fails to give back the 
erroneous function definition. In Python 2.2.3, IDLE 0.8, 
windows XP.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-08 12:38

Message:
Logged In: YES 
user_id=80475

In 2.3b2+, the command line version of python properly 
raises a SyntaxError, but in the new IDLE it doesn't get that 
far because the indent/dedenting is thrown off.





----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-07-08 10:09

Message:
Logged In: YES 
user_id=33168

Could you test with IDLEfork or the IDLE in 2.3b2? 
Hopefully this problem has been fixed for 2.3.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=767794&group_id=5470