]> granicus.if.org Git - python/commitdiff
Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart
authorGuido van Rossum <guido@python.org>
Wed, 23 Jan 2002 15:15:13 +0000 (15:15 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 23 Jan 2002 15:15:13 +0000 (15:15 +0000)
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
Tools/idle/EditorWindow.py

index 87f75c12ee423129f2d6a6a32bbd9191d19e62eb..15b5011d9ed27f4bb563b9b61c158d77678b1ac5 100644 (file)
@@ -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
index bb69a5be3ddb75cd9b0dc4ebede916fd85e1761b..f924c45289d2e4aeedd6f4e27c2c18af7c2fefc3 100644 (file)
@@ -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):