Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
43389202
Commit
43389202
authored
Jan 15, 1999
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added doc strings to the exception classes.
Contributed by Blake Winton, but considerably edited.
parent
40233ea7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
Lib/exceptions.py
Lib/exceptions.py
+29
-3
No files found.
Lib/exceptions.py
View file @
43389202
...
@@ -60,6 +60,7 @@ Exception(*)
...
@@ -60,6 +60,7 @@ Exception(*)
"""
"""
class
Exception
:
class
Exception
:
"""Proposed base class for all exceptions."""
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
self
.
args
=
args
self
.
args
=
args
...
@@ -75,9 +76,11 @@ class Exception:
...
@@ -75,9 +76,11 @@ class Exception:
return
self
.
args
[
i
]
return
self
.
args
[
i
]
class
StandardError
(
Exception
):
class
StandardError
(
Exception
):
"""Base class for all standard Python exceptions."""
pass
pass
class
SyntaxError
(
StandardError
):
class
SyntaxError
(
StandardError
):
"""Invalid syntax."""
filename
=
lineno
=
offset
=
text
=
None
filename
=
lineno
=
offset
=
text
=
None
msg
=
""
msg
=
""
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
...
@@ -94,8 +97,7 @@ class SyntaxError(StandardError):
...
@@ -94,8 +97,7 @@ class SyntaxError(StandardError):
return
str
(
self
.
msg
)
return
str
(
self
.
msg
)
class
EnvironmentError
(
StandardError
):
class
EnvironmentError
(
StandardError
):
"""Base class for exceptions that occur outside the Python system.
"""Base class for I/O related errors."""
Primarily used as a base class for OSError and IOError."""
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
self
.
args
=
args
self
.
args
=
args
self
.
errno
=
None
self
.
errno
=
None
...
@@ -126,70 +128,94 @@ class EnvironmentError(StandardError):
...
@@ -126,70 +128,94 @@ class EnvironmentError(StandardError):
return
StandardError
.
__str__
(
self
)
return
StandardError
.
__str__
(
self
)
class
IOError
(
EnvironmentError
):
class
IOError
(
EnvironmentError
):
"""I/O operation failed."""
pass
pass
class
OSError
(
EnvironmentError
):
class
OSError
(
EnvironmentError
):
"""
Used by the posix module
."""
"""
OS system call failed
."""
pass
pass
class
RuntimeError
(
StandardError
):
class
RuntimeError
(
StandardError
):
"""Unspecified run-time error."""
pass
pass
class
NotImplementedError
(
RuntimeError
):
class
NotImplementedError
(
RuntimeError
):
"""Method or function hasn't been implemented yet."""
pass
pass
class
SystemError
(
StandardError
):
class
SystemError
(
StandardError
):
"""Internal error in the Python interpreter.
Please report this to the Python maintainer, along with the traceback,
the Python version, and the hardware/OS platform and version."""
pass
pass
class
EOFError
(
StandardError
):
class
EOFError
(
StandardError
):
"""Read beyond end of file."""
pass
pass
class
ImportError
(
StandardError
):
class
ImportError
(
StandardError
):
"""Import can't find module, or can't find name in module."""
pass
pass
class
TypeError
(
StandardError
):
class
TypeError
(
StandardError
):
"""Inappropriate argument type."""
pass
pass
class
ValueError
(
StandardError
):
class
ValueError
(
StandardError
):
"""Inappropriate argument value (of correct type)."""
pass
pass
class
KeyboardInterrupt
(
StandardError
):
class
KeyboardInterrupt
(
StandardError
):
"""Program interrupted by user."""
pass
pass
class
AssertionError
(
StandardError
):
class
AssertionError
(
StandardError
):
"""Assertion failed."""
pass
pass
class
ArithmeticError
(
StandardError
):
class
ArithmeticError
(
StandardError
):
"""Base class for arithmetic errors."""
pass
pass
class
OverflowError
(
ArithmeticError
):
class
OverflowError
(
ArithmeticError
):
"""Result too large to be represented."""
pass
pass
class
FloatingPointError
(
ArithmeticError
):
class
FloatingPointError
(
ArithmeticError
):
"""Floating point operation failed."""
pass
pass
class
ZeroDivisionError
(
ArithmeticError
):
class
ZeroDivisionError
(
ArithmeticError
):
"""Second argument to a division or modulo operation was zero."""
pass
pass
class
LookupError
(
StandardError
):
class
LookupError
(
StandardError
):
"""Base class for lookup errors."""
pass
pass
class
IndexError
(
LookupError
):
class
IndexError
(
LookupError
):
"""Sequence index out of range."""
pass
pass
class
KeyError
(
LookupError
):
class
KeyError
(
LookupError
):
"""Mapping key not found."""
pass
pass
class
AttributeError
(
StandardError
):
class
AttributeError
(
StandardError
):
"""Attribute not found."""
pass
pass
class
NameError
(
StandardError
):
class
NameError
(
StandardError
):
"""Name not found locally or globally."""
pass
pass
class
MemoryError
(
StandardError
):
class
MemoryError
(
StandardError
):
"""Out of memory."""
pass
pass
class
SystemExit
(
Exception
):
class
SystemExit
(
Exception
):
"""Request to exit from the interpreter."""
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
self
.
args
=
args
self
.
args
=
args
if
len
(
args
)
==
0
:
if
len
(
args
)
==
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment