[Python-3000-checkins] r58593 - in python/branches/py3k: Lib/asyncore.py Lib/idlelib/run.py Tools/i18n/pygettext.py

georg.brandl python-3000-checkins at python.org
Mon Oct 22 18:16:14 CEST 2007


Author: georg.brandl
Date: Mon Oct 22 18:16:13 2007
New Revision: 58593

Modified:
   python/branches/py3k/Lib/asyncore.py
   python/branches/py3k/Lib/idlelib/run.py
   python/branches/py3k/Tools/i18n/pygettext.py
Log:
In followup to #1310: Remove more exception indexing.


Modified: python/branches/py3k/Lib/asyncore.py
==============================================================================
--- python/branches/py3k/Lib/asyncore.py	(original)
+++ python/branches/py3k/Lib/asyncore.py	Mon Oct 22 18:16:13 2007
@@ -120,7 +120,7 @@
             try:
                 r, w, e = select.select(r, w, e, timeout)
             except select.error as err:
-                if err[0] != EINTR:
+                if err.args[0] != EINTR:
                     raise
                 else:
                     return
@@ -166,7 +166,7 @@
         try:
             r = pollster.poll(timeout)
         except select.error as err:
-            if err[0] != EINTR:
+            if err.args[0] != EINTR:
                 raise
             r = []
         for fd, flags in r:

Modified: python/branches/py3k/Lib/idlelib/run.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/run.py	(original)
+++ python/branches/py3k/Lib/idlelib/run.py	Mon Oct 22 18:16:13 2007
@@ -115,8 +115,8 @@
             server = MyRPCServer(address, MyHandler)
             break
         except socket.error as err:
-            print("IDLE Subprocess: socket error: "\
-                                        + err[1] + ", retrying....", file=sys.__stderr__)
+            print("IDLE Subprocess: socket error: " + err.args[1] +
+                  ", retrying....", file=sys.__stderr__)
     else:
         print("IDLE Subprocess: Connection to "\
                                "IDLE GUI failed, exiting.", file=sys.__stderr__)
@@ -131,14 +131,15 @@
     import tkMessageBox
     root = Tkinter.Tk()
     root.withdraw()
-    if err[0] == 61: # connection refused
+    if err.args[0] == 61: # connection refused
         msg = "IDLE's subprocess can't connect to %s:%d.  This may be due "\
               "to your personal firewall configuration.  It is safe to "\
               "allow this internal connection because no data is visible on "\
               "external ports." % address
         tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root)
     else:
-        tkMessageBox.showerror("IDLE Subprocess Error", "Socket Error: %s" % err[1])
+        tkMessageBox.showerror("IDLE Subprocess Error",
+                               "Socket Error: %s" % err.args[1])
     root.destroy()
 
 def print_exception():

Modified: python/branches/py3k/Tools/i18n/pygettext.py
==============================================================================
--- python/branches/py3k/Tools/i18n/pygettext.py	(original)
+++ python/branches/py3k/Tools/i18n/pygettext.py	Mon Oct 22 18:16:13 2007
@@ -637,7 +637,8 @@
                 tokenize.tokenize(fp.readline, eater)
             except tokenize.TokenError as e:
                 print('%s: %s, line %d, column %d' % (
-                    e[0], filename, e[1][0], e[1][1]), file=sys.stderr)
+                    e.args[0], filename, e.args[1][0], e.args[1][1]),
+                    file=sys.stderr)
         finally:
             if closep:
                 fp.close()


More information about the Python-3000-checkins mailing list