[Python-checkins] cpython (3.4): More idlelib cleanup inspired by pyflakes.

terry.reedy python-checkins at python.org
Wed Jul 2 03:34:17 CEST 2014


http://hg.python.org/cpython/rev/78fc2465f114
changeset:   91518:78fc2465f114
branch:      3.4
parent:      91515:27feb652d3ad
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Tue Jul 01 21:33:31 2014 -0400
summary:
  More idlelib cleanup inspired by pyflakes.

files:
  Lib/idlelib/SearchEngine.py            |  2 +-
  Lib/idlelib/StackViewer.py             |  4 ++--
  Lib/idlelib/idle_test/test_textview.py |  4 ++--
  3 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Lib/idlelib/SearchEngine.py b/Lib/idlelib/SearchEngine.py
--- a/Lib/idlelib/SearchEngine.py
+++ b/Lib/idlelib/SearchEngine.py
@@ -85,7 +85,7 @@
         except re.error as what:
             args = what.args
             msg = args[0]
-            col = arg[1] if len(args) >= 2 else -1
+            col = args[1] if len(args) >= 2 else -1
             self.report_error(pat, msg, col)
             return None
         return prog
diff --git a/Lib/idlelib/StackViewer.py b/Lib/idlelib/StackViewer.py
--- a/Lib/idlelib/StackViewer.py
+++ b/Lib/idlelib/StackViewer.py
@@ -131,8 +131,8 @@
     root.geometry("+%d+%d"%(x, y + 150))
     flist = PyShellFileList(root)
     try: # to obtain a traceback object
-        a
-    except:
+        intentional_name_error
+    except NameError:
         exc_type, exc_value, exc_tb = sys.exc_info()
 
     # inject stack trace to sys
diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py
--- a/Lib/idlelib/idle_test/test_textview.py
+++ b/Lib/idlelib/idle_test/test_textview.py
@@ -12,7 +12,7 @@
 
 import unittest
 import os
-from tkinter import Tk, Text, TclError
+from tkinter import Tk
 from idlelib import textView as tv
 from idlelib.idle_test.mock_idle import Func
 from idlelib.idle_test.mock_tk import Mbox
@@ -23,7 +23,7 @@
 
 def tearDownModule():
     global root
-    root.destroy()
+    root.destroy()  # pyflakes falsely sees root as undefined
     del root
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list