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

Skip to content

Commit 092b3cf

Browse files
committed
More idlelib cleanup inspired by pyflakes.
1 parent d9de794 commit 092b3cf

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/idlelib/SearchEngine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def getprog(self):
8585
except re.error as what:
8686
args = what.args
8787
msg = args[0]
88-
col = arg[1] if len(args) >= 2 else -1
88+
col = args[1] if len(args) >= 2 else -1
8989
self.report_error(pat, msg, col)
9090
return None
9191
return prog

Lib/idlelib/StackViewer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def _stack_viewer(parent):
131131
root.geometry("+%d+%d"%(x, y + 150))
132132
flist = PyShellFileList(root)
133133
try: # to obtain a traceback object
134-
a
135-
except:
134+
intentional_name_error
135+
except NameError:
136136
exc_type, exc_value, exc_tb = sys.exc_info()
137137

138138
# inject stack trace to sys

Lib/idlelib/idle_test/test_textview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import unittest
1414
import os
15-
from tkinter import Tk, Text, TclError
15+
from tkinter import Tk
1616
from idlelib import textView as tv
1717
from idlelib.idle_test.mock_idle import Func
1818
from idlelib.idle_test.mock_tk import Mbox
@@ -23,7 +23,7 @@ def setUpModule():
2323

2424
def tearDownModule():
2525
global root
26-
root.destroy()
26+
root.destroy() # pyflakes falsely sees root as undefined
2727
del root
2828

2929

0 commit comments

Comments
 (0)