Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 596db31

Browse files
committed
Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box: try: ... except socket.error, (code, msg): ...
1 parent bf9d353 commit 596db31

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ def __str__(self):
5858
else:
5959
return str(self.args)
6060

61-
class StandardError(Exception):
6261
def __getitem__(self, i):
6362
return self.args[i]
6463

64+
class StandardError(Exception):
65+
pass
66+
6567
class SyntaxError(StandardError):
6668
filename = lineno = offset = text = None
6769
msg = ""

0 commit comments

Comments
 (0)