summaryrefslogtreecommitdiffstats
path: root/Lib/exceptions.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1997-10-06 15:48:20 (GMT)
committerFred Drake <fdrake@acm.org>1997-10-06 15:48:20 (GMT)
commit596db3161c8cf0a492f5613cb5721b6c12c1dceb (patch)
tree2341eb9f5f2c455f9c606333373f53d96bc6ea10 /Lib/exceptions.py
parentbf9d353babbd4126fc080a9a84ae65cc529b209d (diff)
downloadcpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.zip
cpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.tar.gz
cpython-596db3161c8cf0a492f5613cb5721b6c12c1dceb.tar.bz2
Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box: try: ... except socket.error, (code, msg): ...
Diffstat (limited to 'Lib/exceptions.py')
-rw-r--r--Lib/exceptions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/exceptions.py b/Lib/exceptions.py
index 686ba38..c7bbbf4 100644
--- a/Lib/exceptions.py
+++ b/Lib/exceptions.py
@@ -58,10 +58,12 @@ class Exception:
else:
return str(self.args)
-class StandardError(Exception):
def __getitem__(self, i):
return self.args[i]
+class StandardError(Exception):
+ pass
+
class SyntaxError(StandardError):
filename = lineno = offset = text = None
msg = ""