summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-06 21:13:42 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-06 21:13:42 (GMT)
commitd11b68ab0834be4be76fca479cd4426eb45dfaec (patch)
treebc05f1c9ac1e0460d2f30531fcb31ab09084979e /Lib
parent7357c23ee72d687433452555018e9931159a2dfa (diff)
downloadcpython-d11b68ab0834be4be76fca479cd4426eb45dfaec.zip
cpython-d11b68ab0834be4be76fca479cd4426eb45dfaec.tar.gz
cpython-d11b68ab0834be4be76fca479cd4426eb45dfaec.tar.bz2
Fix more exception slicing.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/file_util.py2
-rw-r--r--Lib/distutils/spawn.py6
-rw-r--r--Lib/filecmp.py4
-rw-r--r--Lib/plat-mac/EasyDialogs.py6
-rw-r--r--Lib/plat-mac/aetools.py2
-rw-r--r--Lib/plat-mac/gensuitemodule.py2
-rw-r--r--Lib/plat-mac/terminalcommand.py2
7 files changed, 12 insertions, 12 deletions
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py
index e29e90e..6919060 100644
--- a/Lib/distutils/file_util.py
+++ b/Lib/distutils/file_util.py
@@ -139,7 +139,7 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
macostools.copy(src, dst, 0, preserve_times)
except os.error as exc:
raise DistutilsFileError(
- "could not copy '%s' to '%s': %s" % (src, dst, exc[-1]))
+ "could not copy '%s' to '%s': %s" % (src, dst, exc.args[-1]))
# If linking (hard or symbolic), use the appropriate system call
# (Unix only, of course, but that's the caller's responsibility)
diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py
index 0aee2bc..4c536d2 100644
--- a/Lib/distutils/spawn.py
+++ b/Lib/distutils/spawn.py
@@ -67,7 +67,7 @@ def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0):
except OSError as exc:
# this seems to happen when the command isn't found
raise DistutilsExecError(
- "command '%s' failed: %s" % (cmd[0], exc[-1]))
+ "command '%s' failed: %s" % (cmd[0], exc.args[-1]))
if rc != 0:
# and this reflects the command running but failing
raise DistutilsExecError(
@@ -88,7 +88,7 @@ def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
except OSError as exc:
# this seems to happen when the command isn't found
raise DistutilsExecError(
- "command '%s' failed: %s" % (cmd[0], exc[-1]))
+ "command '%s' failed: %s" % (cmd[0], exc.args[-1]))
if rc != 0:
# and this reflects the command running but failing
print("command '%s' failed with exit status %d" % (cmd[0], rc))
@@ -124,7 +124,7 @@ def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0):
if exc.errno == errno.EINTR:
continue
raise DistutilsExecError(
- "command '%s' failed: %s" % (cmd[0], exc[-1]))
+ "command '%s' failed: %s" % (cmd[0], exc.args[-1]))
if os.WIFSIGNALED(status):
raise DistutilsExecError(
"command '%s' terminated by signal %d"
diff --git a/Lib/filecmp.py b/Lib/filecmp.py
index 1f599ce..12ba3ef 100644
--- a/Lib/filecmp.py
+++ b/Lib/filecmp.py
@@ -149,12 +149,12 @@ class dircmp:
try:
a_stat = os.stat(a_path)
except os.error as why:
- # print 'Can\'t stat', a_path, ':', why[1]
+ # print('Can\'t stat', a_path, ':', why.args[1])
ok = 0
try:
b_stat = os.stat(b_path)
except os.error as why:
- # print 'Can\'t stat', b_path, ':', why[1]
+ # print('Can\'t stat', b_path, ':', why.args[1])
ok = 0
if ok:
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py
index 2f0e3d3..68beafa 100644
--- a/Lib/plat-mac/EasyDialogs.py
+++ b/Lib/plat-mac/EasyDialogs.py
@@ -651,7 +651,7 @@ def AskFileForOpen(
rr = Nav.NavChooseFile(args)
good = 1
except Nav.error as arg:
- if arg[0] != -128: # userCancelledErr
+ if arg.args[0] != -128: # userCancelledErr
raise Nav.error(arg)
return None
if not rr.validRecord or not rr.selection:
@@ -704,7 +704,7 @@ def AskFileForSave(
rr = Nav.NavPutFile(args)
good = 1
except Nav.error as arg:
- if arg[0] != -128: # userCancelledErr
+ if arg.args[0] != -128: # userCancelledErr
raise Nav.error(arg)
return None
if not rr.validRecord or not rr.selection:
@@ -764,7 +764,7 @@ def AskFolder(
rr = Nav.NavChooseFolder(args)
good = 1
except Nav.error as arg:
- if arg[0] != -128: # userCancelledErr
+ if arg.args[0] != -128: # userCancelledErr
raise Nav.error(arg)
return None
if not rr.validRecord or not rr.selection:
diff --git a/Lib/plat-mac/aetools.py b/Lib/plat-mac/aetools.py
index dd06e3e..7ba5074 100644
--- a/Lib/plat-mac/aetools.py
+++ b/Lib/plat-mac/aetools.py
@@ -86,7 +86,7 @@ def unpackevent(ae, formodulename=""):
try:
desc = ae.AEGetAttributeDesc(key, '****')
except (AE.Error, MacOS.Error) as msg:
- if msg[0] != -1701 and msg[0] != -1704:
+ if msg.args[0] not in (-1701, -1704):
raise
continue
attributes[key] = unpack(desc, formodulename)
diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py
index 1864f4f..9d4df6d 100644
--- a/Lib/plat-mac/gensuitemodule.py
+++ b/Lib/plat-mac/gensuitemodule.py
@@ -191,7 +191,7 @@ def processfile(fullname, output=None, basepkgname=None,
try:
aedescobj, launched = OSATerminology.GetAppTerminology(fullname)
except MacOS.Error as arg:
- if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound
+ if arg.args[0] in (-1701, -192): # errAEDescNotFound, resNotFound
if verbose:
print("GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually", file=verbose)
aedata, sig = getappterminology(fullname, verbose=verbose)
diff --git a/Lib/plat-mac/terminalcommand.py b/Lib/plat-mac/terminalcommand.py
index a2f008c..da1c28a 100644
--- a/Lib/plat-mac/terminalcommand.py
+++ b/Lib/plat-mac/terminalcommand.py
@@ -36,7 +36,7 @@ def run(command):
try:
theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
except AE.Error as why:
- if why[0] != -600: # Terminal.app not yet running
+ if why.args[0] != -600: # Terminal.app not yet running
raise
os.system(START_TERMINAL)
time.sleep(1)