[Python-3000-checkins] r57308 - python/branches/py3k/Lib/idlelib/EditorWindow.py python/branches/py3k/Lib/idlelib/IOBinding.py python/branches/py3k/Lib/idlelib/RemoteDebugger.py python/branches/py3k/Lib/idlelib/TreeWidget.py python/branches/py3k/Lib/idlelib/configHandler.py python/branches/py3k/Lib/idlelib/rpc.py python/branches/py3k/Lib/idlelib/tabpage.py

kurt.kaiser python-3000-checkins at python.org
Thu Aug 23 03:06:16 CEST 2007


Author: kurt.kaiser
Date: Thu Aug 23 03:06:15 2007
New Revision: 57308

Modified:
   python/branches/py3k/Lib/idlelib/EditorWindow.py
   python/branches/py3k/Lib/idlelib/IOBinding.py
   python/branches/py3k/Lib/idlelib/RemoteDebugger.py
   python/branches/py3k/Lib/idlelib/TreeWidget.py
   python/branches/py3k/Lib/idlelib/configHandler.py
   python/branches/py3k/Lib/idlelib/rpc.py
   python/branches/py3k/Lib/idlelib/tabpage.py
Log:
Fix raise with 2to3

M    idlelib/configHandler.py
M    idlelib/tabpage.py
M    idlelib/EditorWindow.py
M    idlelib/rpc.py
M    idlelib/IOBinding.py
M    idlelib/RemoteDebugger.py
M    idlelib/TreeWidget.py


Modified: python/branches/py3k/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/EditorWindow.py	(original)
+++ python/branches/py3k/Lib/idlelib/EditorWindow.py	Thu Aug 23 03:06:15 2007
@@ -38,7 +38,7 @@
         try:
             path = module.__path__
         except AttributeError:
-            raise ImportError, 'No source for module ' + module.__name__
+            raise ImportError('No source for module ' + module.__name__)
     return file, filename, descr
 
 class EditorWindow(object):
@@ -955,14 +955,14 @@
             value = var.get()
             return value
         else:
-            raise NameError, name
+            raise NameError(name)
 
     def setvar(self, name, value, vartype=None):
         var = self.get_var_obj(name, vartype)
         if var:
             var.set(value)
         else:
-            raise NameError, name
+            raise NameError(name)
 
     def get_var_obj(self, name, vartype=None):
         var = self.tkinter_vars.get(name)

Modified: python/branches/py3k/Lib/idlelib/IOBinding.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/IOBinding.py	(original)
+++ python/branches/py3k/Lib/idlelib/IOBinding.py	Thu Aug 23 03:06:15 2007
@@ -132,7 +132,7 @@
         codecs.lookup(name)
     except LookupError:
         # The standard encoding error does not indicate the encoding
-        raise LookupError, "Unknown encoding "+name
+        raise LookupError("Unknown encoding "+name)
     return name
 
 

Modified: python/branches/py3k/Lib/idlelib/RemoteDebugger.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/RemoteDebugger.py	(original)
+++ python/branches/py3k/Lib/idlelib/RemoteDebugger.py	Thu Aug 23 03:06:15 2007
@@ -206,7 +206,7 @@
 
     def __getattr__(self, name):
         if name[:1] == "_":
-            raise AttributeError, name
+            raise AttributeError(name)
         if name == "f_code":
             return self._get_f_code()
         if name == "f_globals":
@@ -270,7 +270,7 @@
 
     def __getattr__(self, name):
         ##print >>sys.__stderr__, "failed DictProxy.__getattr__:", name
-        raise AttributeError, name
+        raise AttributeError(name)
 
 
 class GUIAdapter:

Modified: python/branches/py3k/Lib/idlelib/TreeWidget.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/TreeWidget.py	(original)
+++ python/branches/py3k/Lib/idlelib/TreeWidget.py	Thu Aug 23 03:06:15 2007
@@ -32,7 +32,7 @@
 if os.path.isdir(_icondir):
     ICONDIR = _icondir
 elif not os.path.isdir(ICONDIR):
-    raise RuntimeError, "can't find icon directory (%r)" % (ICONDIR,)
+    raise RuntimeError("can't find icon directory (%r)" % (ICONDIR,))
 
 def listicons(icondir=ICONDIR):
     """Utility to display the available icons."""

Modified: python/branches/py3k/Lib/idlelib/configHandler.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/configHandler.py	(original)
+++ python/branches/py3k/Lib/idlelib/configHandler.py	Thu Aug 23 03:06:15 2007
@@ -259,13 +259,13 @@
         configType must be one of ('main','extensions','highlight','keys')
         """
         if not (configType in ('main','extensions','highlight','keys')):
-            raise InvalidConfigType, 'Invalid configType specified'
+            raise InvalidConfigType('Invalid configType specified')
         if configSet == 'user':
             cfgParser=self.userCfg[configType]
         elif configSet == 'default':
             cfgParser=self.defaultCfg[configType]
         else:
-            raise InvalidConfigSet, 'Invalid configSet specified'
+            raise InvalidConfigSet('Invalid configSet specified')
         return cfgParser.sections()
 
     def GetHighlight(self, theme, element, fgBg=None):
@@ -293,7 +293,7 @@
             if fgBg == 'bg':
                 return highlight["background"]
             else:
-                raise InvalidFgBg, 'Invalid fgBg specified'
+                raise InvalidFgBg('Invalid fgBg specified')
 
     def GetThemeDict(self,type,themeName):
         """
@@ -309,7 +309,7 @@
         elif type == 'default':
             cfgParser=self.defaultCfg['highlight']
         else:
-            raise InvalidTheme, 'Invalid theme type specified'
+            raise InvalidTheme('Invalid theme type specified')
         #foreground and background values are provded for each theme element
         #(apart from cursor) even though all these values are not yet used
         #by idle, to allow for their use in the future. Default values are
@@ -624,7 +624,7 @@
         elif configSet=='default':
             cfgParser=self.defaultCfg['main']
         else:
-            raise InvalidConfigSet, 'Invalid configSet specified'
+            raise InvalidConfigSet('Invalid configSet specified')
         options=cfgParser.GetOptionList('HelpFiles')
         for option in options:
             value=cfgParser.Get('HelpFiles',option,default=';')

Modified: python/branches/py3k/Lib/idlelib/rpc.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/rpc.py	(original)
+++ python/branches/py3k/Lib/idlelib/rpc.py	Thu Aug 23 03:06:15 2007
@@ -256,8 +256,8 @@
             return None
         if how == "ERROR":
             self.debug("decoderesponse: Internal ERROR:", what)
-            raise RuntimeError, what
-        raise SystemError, (how, what)
+            raise RuntimeError(what)
+        raise SystemError(how, what)
 
     def decode_interrupthook(self):
         ""
@@ -331,7 +331,7 @@
                 r, w, x = select.select([], [self.sock], [])
                 n = self.sock.send(s[:BUFSIZE])
             except (AttributeError, TypeError):
-                raise IOError, "socket no longer exists"
+                raise IOError("socket no longer exists")
             except socket.error:
                 raise
             else:
@@ -557,7 +557,7 @@
                                            (name,), {})
             return value
         else:
-            raise AttributeError, name
+            raise AttributeError(name)
 
     def __getattributes(self):
         self.__attributes = self.sockio.remotecall(self.oid,

Modified: python/branches/py3k/Lib/idlelib/tabpage.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/tabpage.py	(original)
+++ python/branches/py3k/Lib/idlelib/tabpage.py	Thu Aug 23 03:06:15 2007
@@ -46,7 +46,7 @@
             if pageName in self.pages.keys():
                 self.activePage.set(pageName)
             else:
-                raise InvalidTabPage, 'Invalid TabPage Name'
+                raise InvalidTabPage('Invalid TabPage Name')
         ## pop up the active 'tab' only
         for page in self.pages.keys():
             self.pages[page]['tab'].config(relief=RIDGE)
@@ -59,7 +59,7 @@
 
     def AddPage(self,pageName):
         if pageName in self.pages.keys():
-            raise AlreadyExists, 'TabPage Name Already Exists'
+            raise AlreadyExists('TabPage Name Already Exists')
         self.pages[pageName]={'tab':PageTab(self.tabBar),
                 'page':Frame(self,borderwidth=2,relief=RAISED)}
         self.pages[pageName]['tab'].button.config(text=pageName,
@@ -74,7 +74,7 @@
 
     def RemovePage(self,pageName):
         if not pageName in self.pages.keys():
-            raise InvalidTabPage, 'Invalid TabPage Name'
+            raise InvalidTabPage('Invalid TabPage Name')
         self.pages[pageName]['tab'].pack_forget()
         self.pages[pageName]['page'].grid_forget()
         self.pages[pageName]['tab'].destroy()


More information about the Python-3000-checkins mailing list