[Idle-dev] [ idlefork-Bugs-507298 ] python2.2 -Qnew shell smart indent error

noreply@sourceforge.net noreply@sourceforge.net
Tue, 22 Jan 2002 21:20:43 -0800


Bugs item #507298, was opened at 2002-01-22 17:16
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=109579&aid=507298&group_id=9579

Category: None
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Stephen M. Gava (elguavas)
Assigned to: Stephen M. Gava (elguavas)
Summary: python2.2 -Qnew shell smart indent error

Initial Comment:
submitted to idle-dev by  	
Gregor Lingl <glingl@aon.at>

when starting idle under python2.2, using python2.2's
-Qnew switch (new division implementation),
AutoIndent.py throws an exception in the shell window
as detailed below.

original idle-dev message:
--------------------------

Has anybody an explanation vor this:
 
I started IDLE with the -Qnew switch.
(I have a copy of the IDLE-Icon with this switch on my
desktop)
Then I did the following in IDLE's Python-Shell-Window:
 
>>>def ggt(a,b):
       while b:  ##### WHEN NOW I HIT ENTER,
                 ##### THE RESULT WAS:
 
>>> Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python22\lib\lib-tk\Tkinter.py", line 1292,
in __call__
    return apply(self.func, args)
  File "C:\Python22\Tools\idle\PyShell.py", line 588,
in enter_callback
    self.auto.auto_indent(event)
  File "C:\Python22\Tools\idle\AutoIndent.py", line
301, in newline_and_indent_event
    self.smart_indent_event(event)
  File "C:\Python22\Tools\idle\AutoIndent.py", line
208, in smart_indent_event
    self.reindent_to(effective + self.indentwidth)
  File "C:\Python22\Tools\idle\AutoIndent.py", line
455, in reindent_to
    text.insert("insert", self._make_blanks(column))
  File "C:\Python22\Tools\idle\AutoIndent.py", line
442, in _make_blanks
    return '\t' * ntabs + ' ' * nspaces
TypeError: unsupported operand type(s) for *: 'str' and
'float'
def ggt(a,b):
     while b:
 
So the cryptic Error - backtrace appeard after the >>>
- Prompt 
and BEFORE the two lines I just had typed in.
 
Moreover, I only could return to the >>> - prompt 
by hitting ^C (Keybord-Interrupt)
 
This strange behaviour doesn't appear in ordinarily
started IDLE.
It also does not appear when starting Python (with or
without -Qnew)
from the MS-DOS prompt.


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

Comment By: Stephen M. Gava (elguavas)
Date: 2002-01-22 21:20

Message:
Logged In: YES 
user_id=75867

used fix applied to python idle by Tim Peters,
thanks Tim!

!             effective = (effective / tabwidth + 1) * tabwidth
-------
!             effective = (int(effective / tabwidth) + 1) *
tabwidth


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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=109579&aid=507298&group_id=9579