summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Palard <julien@palard.fr>2021-06-11 06:53:52 (GMT)
committerGitHub <noreply@github.com>2021-06-11 06:53:52 (GMT)
commitc4955e2c4f9abafd33bbe4904a82f7962333a7d6 (patch)
tree0e631d373c31d17a9509cf122d3eb86096a86550
parent62f1d2b3d7dda99598d053e10b785c463fdcf591 (diff)
downloadcpython-c4955e2c4f9abafd33bbe4904a82f7962333a7d6.zip
cpython-c4955e2c4f9abafd33bbe4904a82f7962333a7d6.tar.gz
cpython-c4955e2c4f9abafd33bbe4904a82f7962333a7d6.tar.bz2
Doc: Prettier exception hierarchy. (GH-26533)
-rw-r--r--Doc/library/exceptions.rst1
-rw-r--r--Lib/test/exception_hierarchy.txt128
-rw-r--r--Lib/test/test_baseexception.py2
3 files changed, 66 insertions, 65 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index d5d81df..0a5037a 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -821,3 +821,4 @@ Exception hierarchy
The class hierarchy for built-in exceptions is:
.. literalinclude:: ../../Lib/test/exception_hierarchy.txt
+ :language: text
diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt
index 6c5e821..cf54454 100644
--- a/Lib/test/exception_hierarchy.txt
+++ b/Lib/test/exception_hierarchy.txt
@@ -1,65 +1,65 @@
BaseException
- +-- SystemExit
- +-- KeyboardInterrupt
- +-- GeneratorExit
- +-- Exception
- +-- StopIteration
- +-- StopAsyncIteration
- +-- ArithmeticError
- | +-- FloatingPointError
- | +-- OverflowError
- | +-- ZeroDivisionError
- +-- AssertionError
- +-- AttributeError
- +-- BufferError
- +-- EOFError
- +-- ImportError
- | +-- ModuleNotFoundError
- +-- LookupError
- | +-- IndexError
- | +-- KeyError
- +-- MemoryError
- +-- NameError
- | +-- UnboundLocalError
- +-- OSError
- | +-- BlockingIOError
- | +-- ChildProcessError
- | +-- ConnectionError
- | | +-- BrokenPipeError
- | | +-- ConnectionAbortedError
- | | +-- ConnectionRefusedError
- | | +-- ConnectionResetError
- | +-- FileExistsError
- | +-- FileNotFoundError
- | +-- InterruptedError
- | +-- IsADirectoryError
- | +-- NotADirectoryError
- | +-- PermissionError
- | +-- ProcessLookupError
- | +-- TimeoutError
- +-- ReferenceError
- +-- RuntimeError
- | +-- NotImplementedError
- | +-- RecursionError
- +-- SyntaxError
- | +-- IndentationError
- | +-- TabError
- +-- SystemError
- +-- TypeError
- +-- ValueError
- | +-- UnicodeError
- | +-- UnicodeDecodeError
- | +-- UnicodeEncodeError
- | +-- UnicodeTranslateError
- +-- Warning
- +-- DeprecationWarning
- +-- PendingDeprecationWarning
- +-- RuntimeWarning
- +-- SyntaxWarning
- +-- UserWarning
- +-- FutureWarning
- +-- ImportWarning
- +-- UnicodeWarning
- +-- BytesWarning
- +-- EncodingWarning
- +-- ResourceWarning
+ ├── SystemExit
+ ├── KeyboardInterrupt
+ ├── GeneratorExit
+ └── Exception
+ ├── StopIteration
+ ├── StopAsyncIteration
+ ├── ArithmeticError
+ │ ├── FloatingPointError
+ │ ├── OverflowError
+ │ └── ZeroDivisionError
+ ├── AssertionError
+ ├── AttributeError
+ ├── BufferError
+ ├── EOFError
+ ├── ImportError
+ │ └── ModuleNotFoundError
+ ├── LookupError
+ │ ├── IndexError
+ │ └── KeyError
+ ├── MemoryError
+ ├── NameError
+ │ └── UnboundLocalError
+ ├── OSError
+ │ ├── BlockingIOError
+ │ ├── ChildProcessError
+ │ ├── ConnectionError
+ │ │ ├── BrokenPipeError
+ │ │ ├── ConnectionAbortedError
+ │ │ ├── ConnectionRefusedError
+ │ │ └── ConnectionResetError
+ │ ├── FileExistsError
+ │ ├── FileNotFoundError
+ │ ├── InterruptedError
+ │ ├── IsADirectoryError
+ │ ├── NotADirectoryError
+ │ ├── PermissionError
+ │ ├── ProcessLookupError
+ │ └── TimeoutError
+ ├── ReferenceError
+ ├── RuntimeError
+ │ ├── NotImplementedError
+ │ └── RecursionError
+ ├── SyntaxError
+ │ └── IndentationError
+ │ └── TabError
+ ├── SystemError
+ ├── TypeError
+ ├── ValueError
+ │ └── UnicodeError
+ │ ├── UnicodeDecodeError
+ │ ├── UnicodeEncodeError
+ │ └── UnicodeTranslateError
+ └── Warning
+ ├── DeprecationWarning
+ ├── PendingDeprecationWarning
+ ├── RuntimeWarning
+ ├── SyntaxWarning
+ ├── UserWarning
+ ├── FutureWarning
+ ├── ImportWarning
+ ├── UnicodeWarning
+ ├── BytesWarning
+ ├── EncodingWarning
+ └── ResourceWarning
diff --git a/Lib/test/test_baseexception.py b/Lib/test/test_baseexception.py
index 8db497a..0061b3f 100644
--- a/Lib/test/test_baseexception.py
+++ b/Lib/test/test_baseexception.py
@@ -44,7 +44,7 @@ class ExceptionClassTests(unittest.TestCase):
last_depth = 0
for exc_line in inheritance_tree:
exc_line = exc_line.rstrip()
- depth = exc_line.rindex('-')
+ depth = exc_line.rindex('─')
exc_name = exc_line[depth+2:] # Slice past space
if '(' in exc_name:
paren_index = exc_name.index('(')