Kaydet (Commit) 6464d471 authored tarafından Georg Brandl's avatar Georg Brandl

In followup to #1310: Remove more exception indexing.

üst b8990aac
...@@ -120,7 +120,7 @@ def poll(timeout=0.0, map=None): ...@@ -120,7 +120,7 @@ def poll(timeout=0.0, map=None):
try: try:
r, w, e = select.select(r, w, e, timeout) r, w, e = select.select(r, w, e, timeout)
except select.error as err: except select.error as err:
if err[0] != EINTR: if err.args[0] != EINTR:
raise raise
else: else:
return return
...@@ -166,7 +166,7 @@ def poll2(timeout=0.0, map=None): ...@@ -166,7 +166,7 @@ def poll2(timeout=0.0, map=None):
try: try:
r = pollster.poll(timeout) r = pollster.poll(timeout)
except select.error as err: except select.error as err:
if err[0] != EINTR: if err.args[0] != EINTR:
raise raise
r = [] r = []
for fd, flags in r: for fd, flags in r:
......
...@@ -115,8 +115,8 @@ def manage_socket(address): ...@@ -115,8 +115,8 @@ def manage_socket(address):
server = MyRPCServer(address, MyHandler) server = MyRPCServer(address, MyHandler)
break break
except socket.error as err: except socket.error as err:
print("IDLE Subprocess: socket error: "\ print("IDLE Subprocess: socket error: " + err.args[1] +
+ err[1] + ", retrying....", file=sys.__stderr__) ", retrying....", file=sys.__stderr__)
else: else:
print("IDLE Subprocess: Connection to "\ print("IDLE Subprocess: Connection to "\
"IDLE GUI failed, exiting.", file=sys.__stderr__) "IDLE GUI failed, exiting.", file=sys.__stderr__)
...@@ -131,14 +131,15 @@ def show_socket_error(err, address): ...@@ -131,14 +131,15 @@ def show_socket_error(err, address):
import tkMessageBox import tkMessageBox
root = Tkinter.Tk() root = Tkinter.Tk()
root.withdraw() 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 "\ msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\
"to your personal firewall configuration. It is safe to "\ "to your personal firewall configuration. It is safe to "\
"allow this internal connection because no data is visible on "\ "allow this internal connection because no data is visible on "\
"external ports." % address "external ports." % address
tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root) tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root)
else: else:
tkMessageBox.showerror("IDLE Subprocess Error", "Socket Error: %s" % err[1]) tkMessageBox.showerror("IDLE Subprocess Error",
"Socket Error: %s" % err.args[1])
root.destroy() root.destroy()
def print_exception(): def print_exception():
......
...@@ -637,7 +637,8 @@ def main(): ...@@ -637,7 +637,8 @@ def main():
tokenize.tokenize(fp.readline, eater) tokenize.tokenize(fp.readline, eater)
except tokenize.TokenError as e: except tokenize.TokenError as e:
print('%s: %s, line %d, column %d' % ( 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: finally:
if closep: if closep:
fp.close() fp.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment