Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64e9d61

Browse files
committed
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.)
1 parent af14289 commit 64e9d61

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Tools/idle/AutoIndent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def smart_backspace_event(self, event):
171171
expand, tabwidth = string.expandtabs, self.tabwidth
172172
have = len(expand(chars, tabwidth))
173173
assert have > 0
174-
want = int((have - 1) / self.indentwidth) * self.indentwidth
174+
want = int((have - 1) // self.indentwidth) * self.indentwidth
175175
ncharsdeleted = 0
176176
while 1:
177177
chars = chars[:-1]
@@ -495,7 +495,7 @@ def classifyws(s, tabwidth):
495495
effective = effective + 1
496496
elif ch == '\t':
497497
raw = raw + 1
498-
effective = (int(effective / tabwidth) + 1) * tabwidth
498+
effective = (effective // tabwidth + 1) * tabwidth
499499
else:
500500
break
501501
return raw, effective

Tools/idle/EditorWindow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def center(self, mark="insert"):
465465
top, bot = self.getwindowlines()
466466
lineno = self.getlineno(mark)
467467
height = bot - top
468-
newtop = max(1, lineno - height/2)
468+
newtop = max(1, lineno - height//2)
469469
text.yview(float(newtop))
470470

471471
def getwindowlines(self):

0 commit comments

Comments
 (0)