From 64e9d61a1e863d489edbc42a3c5d58d9c1eaa671 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 23 Jan 2002 15:15:13 +0000 Subject: [PATCH] Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart indent error Use // where int division is intended. (This breaks IDLE for use with previous Python versions -- I don't care.) --- Tools/idle/AutoIndent.py | 4 ++-- Tools/idle/EditorWindow.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/idle/AutoIndent.py b/Tools/idle/AutoIndent.py index 87f75c12ee4..15b5011d9ed 100644 --- a/Tools/idle/AutoIndent.py +++ b/Tools/idle/AutoIndent.py @@ -171,7 +171,7 @@ class AutoIndent: expand, tabwidth = string.expandtabs, self.tabwidth have = len(expand(chars, tabwidth)) assert have > 0 - want = int((have - 1) / self.indentwidth) * self.indentwidth + want = int((have - 1) // self.indentwidth) * self.indentwidth ncharsdeleted = 0 while 1: chars = chars[:-1] @@ -495,7 +495,7 @@ def classifyws(s, tabwidth): effective = effective + 1 elif ch == '\t': raw = raw + 1 - effective = (int(effective / tabwidth) + 1) * tabwidth + effective = (effective // tabwidth + 1) * tabwidth else: break return raw, effective diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py index bb69a5be3dd..f924c45289d 100644 --- a/Tools/idle/EditorWindow.py +++ b/Tools/idle/EditorWindow.py @@ -465,7 +465,7 @@ class EditorWindow: top, bot = self.getwindowlines() lineno = self.getlineno(mark) height = bot - top - newtop = max(1, lineno - height/2) + newtop = max(1, lineno - height//2) text.yview(float(newtop)) def getwindowlines(self):