mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box: try: ... except socket.error, (code, msg): ...
This commit is contained in:
parent
bf9d353bab
commit
596db3161c
1 changed files with 3 additions and 1 deletions
|
@ -58,10 +58,12 @@ class Exception:
|
||||||
else:
|
else:
|
||||||
return str(self.args)
|
return str(self.args)
|
||||||
|
|
||||||
class StandardError(Exception):
|
|
||||||
def __getitem__(self, i):
|
def __getitem__(self, i):
|
||||||
return self.args[i]
|
return self.args[i]
|
||||||
|
|
||||||
|
class StandardError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
class SyntaxError(StandardError):
|
class SyntaxError(StandardError):
|
||||||
filename = lineno = offset = text = None
|
filename = lineno = offset = text = None
|
||||||
msg = ""
|
msg = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue