Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(54)

Side by Side Diff: Doc/library/exceptions.rst

Issue 18758: Fix internal references in the documentation
Patch Set: Created 6 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/enum.rst ('k') | Doc/library/fileinput.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. _bltin-exceptions: 1 .. _bltin-exceptions:
2 2
3 Built-in Exceptions 3 Built-in Exceptions
4 =================== 4 ===================
5 5
6 .. index:: 6 .. index::
7 statement: try 7 statement: try
8 statement: except 8 statement: except
9 9
10 In Python, all exceptions must be instances of a class that derives from 10 In Python, all exceptions must be instances of a class that derives from
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 .. exception:: AttributeError 140 .. exception:: AttributeError
141 141
142 Raised when an attribute reference (see :ref:`attribute-references`) or 142 Raised when an attribute reference (see :ref:`attribute-references`) or
143 assignment fails. (When an object does not support attribute references or 143 assignment fails. (When an object does not support attribute references or
144 attribute assignments at all, :exc:`TypeError` is raised.) 144 attribute assignments at all, :exc:`TypeError` is raised.)
145 145
146 146
147 .. exception:: EOFError 147 .. exception:: EOFError
148 148
149 Raised when one of the built-in functions (:func:`input` or :func:`raw_input` ) 149 Raised when the :func:`input` function hits an end-of-file condition (EOF)
150 hits an end-of-file condition (EOF) without reading any data. (N.B.: the 150 without reading any data. (N.B.: the :meth:`io.IOBase.read` and
151 :meth:`file.read` and :meth:`file.readline` methods return an empty string 151 :meth:`io.IOBase.readline` methods return an empty string when they hit EOF.)
152 when they hit EOF.)
153 152
154 153
155 .. exception:: FloatingPointError 154 .. exception:: FloatingPointError
156 155
157 Raised when a floating point operation fails. This exception is always defin ed, 156 Raised when a floating point operation fails. This exception is always defin ed,
158 but can only be raised when Python is configured with the 157 but can only be raised when Python is configured with the
159 ``--with-fpectl`` option, or the :const:`WANT_SIGFPE_HANDLER` symbol is 158 ``--with-fpectl`` option, or the :const:`WANT_SIGFPE_HANDLER` symbol is
160 defined in the :file:`pyconfig.h` file. 159 defined in the :file:`pyconfig.h` file.
161 160
162 161
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 Instances have an attribute :attr:`!code` which is set to the proposed exit 358 Instances have an attribute :attr:`!code` which is set to the proposed exit
360 status or error message (defaulting to ``None``). Also, this exception derive s 359 status or error message (defaulting to ``None``). Also, this exception derive s
361 directly from :exc:`BaseException` and not :exc:`Exception`, since it is not 360 directly from :exc:`BaseException` and not :exc:`Exception`, since it is not
362 technically an error. 361 technically an error.
363 362
364 A call to :func:`sys.exit` is translated into an exception so that clean-up 363 A call to :func:`sys.exit` is translated into an exception so that clean-up
365 handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be 364 handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be
366 executed, and so that a debugger can execute a script without running the ris k 365 executed, and so that a debugger can execute a script without running the ris k
367 of losing control. The :func:`os._exit` function can be used if it is 366 of losing control. The :func:`os._exit` function can be used if it is
368 absolutely positively necessary to exit immediately (for example, in the chil d 367 absolutely positively necessary to exit immediately (for example, in the chil d
369 process after a call to :func:`fork`). 368 process after a call to :func:`os.fork`).
370 369
371 The exception inherits from :exc:`BaseException` instead of :exc:`Exception` so 370 The exception inherits from :exc:`BaseException` instead of :exc:`Exception` so
372 that it is not accidentally caught by code that catches :exc:`Exception`. Th is 371 that it is not accidentally caught by code that catches :exc:`Exception`. Th is
373 allows the exception to properly propagate up and cause the interpreter to ex it. 372 allows the exception to properly propagate up and cause the interpreter to ex it.
374 373
375 374
376 .. exception:: TypeError 375 .. exception:: TypeError
377 376
378 Raised when an operation or function is applied to an object of inappropriate 377 Raised when an operation or function is applied to an object of inappropriate
379 type. The associated value is a string giving details about the type mismatc h. 378 type. The associated value is a string giving details about the type mismatc h.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 Base class for warnings about probable mistakes in module imports. 621 Base class for warnings about probable mistakes in module imports.
623 622
624 623
625 .. exception:: UnicodeWarning 624 .. exception:: UnicodeWarning
626 625
627 Base class for warnings related to Unicode. 626 Base class for warnings related to Unicode.
628 627
629 628
630 .. exception:: BytesWarning 629 .. exception:: BytesWarning
631 630
632 Base class for warnings related to :class:`bytes` and :class:`buffer`. 631 Base class for warnings related to :class:`bytes` and :class:`bytearray`.
633 632
634 633
635 .. exception:: ResourceWarning 634 .. exception:: ResourceWarning
636 635
637 Base class for warnings related to resource usage. 636 Base class for warnings related to resource usage.
638 637
639 .. versionadded:: 3.2 638 .. versionadded:: 3.2
640 639
641 640
642 641
643 Exception hierarchy 642 Exception hierarchy
644 ------------------- 643 -------------------
645 644
646 The class hierarchy for built-in exceptions is: 645 The class hierarchy for built-in exceptions is:
647 646
648 .. literalinclude:: ../../Lib/test/exception_hierarchy.txt 647 .. literalinclude:: ../../Lib/test/exception_hierarchy.txt
OLDNEW
« no previous file with comments | « Doc/library/enum.rst ('k') | Doc/library/fileinput.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+