[Python-checkins] cpython (2.7): Idlelib: silence two buildbot Deprecation Warnings with better code.

terry.reedy python-checkins at python.org
Wed Jan 29 05:14:37 CET 2014


http://hg.python.org/cpython/rev/d45436cb8870
changeset: 88801:d45436cb8870
branch: 2.7
parent: 88791:ca5431a434d6
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Tue Jan 28 23:13:35 2014 -0500
summary:
 Idlelib: silence two buildbot Deprecation Warnings with better code.
files:
 Lib/idlelib/Debugger.py | 4 ++--
 Lib/idlelib/SearchEngine.py | 10 ++++------
 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/Lib/idlelib/Debugger.py b/Lib/idlelib/Debugger.py
--- a/Lib/idlelib/Debugger.py
+++ b/Lib/idlelib/Debugger.py
@@ -253,8 +253,8 @@
 if self.vsource.get():
 self.sync_source_line()
 
- def show_frame(self, (frame, lineno)):
- self.frame = frame
+ def show_frame(self, stackitem):
+ self.frame = stackitem[0] # lineno is stackitem[1]
 self.show_variables()
 
 localsviewer = None
diff --git a/Lib/idlelib/SearchEngine.py b/Lib/idlelib/SearchEngine.py
--- a/Lib/idlelib/SearchEngine.py
+++ b/Lib/idlelib/SearchEngine.py
@@ -83,11 +83,9 @@
 try:
 prog = re.compile(pat, flags)
 except re.error as what:
- try:
- msg, col = what
- except:
- msg = str(what)
- col = -1
+ args = what.args
+ msg = args[0]
+ col = arg[1] if len(args) >= 2 else -1
 self.report_error(pat, msg, col)
 return None
 return prog
@@ -231,6 +229,6 @@
 return line, col
 
 if __name__ == "__main__":
- from test import support; support.use_resources = ['gui']
+ from test import test_support; test_support.use_resources = ['gui']
 import unittest
 unittest.main('idlelib.idle_test.test_searchengine', verbosity=2, exit=False)
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /