bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037)
authorStéphane Wirtel <stephane@wirtel.be>
Fri, 26 Oct 2018 10:52:11 +0000 (12:52 +0200)
committerVictor Stinner <vstinner@redhat.com>
Fri, 26 Oct 2018 10:52:11 +0000 (12:52 +0200)
17 files changed:
Doc/c-api/conversion.rst
Doc/faq/design.rst
Doc/faq/extending.rst
Doc/glossary.rst
Doc/library/configparser.rst
Doc/library/imp.rst
Doc/library/importlib.rst
Doc/library/io.rst
Doc/library/os.path.rst
Doc/library/ssl.rst
Doc/library/typing.rst
Doc/library/unittest.rst
Doc/tutorial/datastructures.rst
Doc/whatsnew/3.5.rst
Doc/whatsnew/3.6.rst
Doc/whatsnew/3.7.rst
Misc/NEWS.d/next/Documentation/2018-10-22-14-09-58.bpo-35044.qjvNtI.rst [new file with mode: 0644]

index 9566d9d792000dff0f16a89b1b62e474e933e8a1..c46722d782a2fb7c44c67eef1a04cf903f313a6f 100644 (file)
@@ -60,7 +60,7 @@ The following functions provide locale-independent string to number conversions.
    The conversion is independent of the current locale.
 
    If ``endptr`` is ``NULL``, convert the whole string.  Raise
-   ValueError and return ``-1.0`` if the string is not a valid
+   :exc:`ValueError` and return ``-1.0`` if the string is not a valid
    representation of a floating-point number.
 
    If endptr is not ``NULL``, convert as much of the string as
index 5e54df61bda9c9b086ffd8587aa909737461cd70..e2d63a0323da661b043e6672b5c4e3e2df79df27 100644 (file)
@@ -528,7 +528,7 @@ Some unacceptable solutions that have been proposed:
      mydict = {[1, 2]: '12'}
      print(mydict[[1, 2]])
 
-  would raise a KeyError exception because the id of the ``[1, 2]`` used in the
+  would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` used in the
   second line differs from that in the first line.  In other words, dictionary
   keys should be compared using ``==``, not using :keyword:`is`.
 
index fd04a83df33c3df29d2ce10896d1021e16ec4df7..b611bb48012af92ea3a6765bb258cdeec4b815f8 100644 (file)
@@ -63,7 +63,7 @@ How can I execute arbitrary Python statements from C?
 The highest-level function to do this is :c:func:`PyRun_SimpleString` which takes
 a single string argument to be executed in the context of the module
 ``__main__`` and returns ``0`` for success and ``-1`` when an exception occurred
-(including ``SyntaxError``).  If you want more control, use
+(including :exc:`SyntaxError`).  If you want more control, use
 :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in
 ``Python/pythonrun.c``.
 
index 16fc7f0783c8cbc94b7574ffae35aa4d6381ad49..b8e773741ce7e21fb97cd6927bcd220fca2803d4 100644 (file)
@@ -200,7 +200,7 @@ Glossary
       ``int(3.15)`` converts the floating point number to the integer ``3``, but
       in ``3+4.5``, each argument is of a different type (one int, one float),
       and both must be converted to the same type before they can be added or it
-      will raise a ``TypeError``.  Without coercion, all arguments of even
+      will raise a :exc:`TypeError`.  Without coercion, all arguments of even
       compatible types would have to be normalized to the same value by the
       programmer, e.g., ``float(3)+4.5`` rather than just ``3+4.5``.
 
index fcca97aeff753ea6ff8959ffe59be2ae0b517f61..1a5417f89304ac4b057cd571493fa304788f2bf7 100644 (file)
@@ -401,11 +401,11 @@ However, there are a few differences that should be taken into account:
   because default values cannot be deleted from the section (because technically
   they are not there).  If they are overridden in the section, deleting causes
   the default value to be visible again.  Trying to delete a default value
-  causes a ``KeyError``.
+  causes a :exc:`KeyError`.
 
 * ``DEFAULTSECT`` cannot be removed from the parser:
 
-  * trying to delete it raises ``ValueError``,
+  * trying to delete it raises :exc:`ValueError`,
 
   * ``parser.clear()`` leaves it intact,
 
index ccf5f92d1636a3366d63da121d758ded6d4d7b07..1bd6f12b915f89bc9667ad6f4491098349a80860 100644 (file)
@@ -229,7 +229,7 @@ file paths.
    file path.  For example, if *path* is
    ``/foo/bar/__pycache__/baz.cpython-32.pyc`` the returned path would be
    ``/foo/bar/baz.py``.  *path* need not exist, however if it does not conform
-   to :pep:`3147` format, a ``ValueError`` is raised. If
+   to :pep:`3147` format, a :exc:`ValueError` is raised. If
    :attr:`sys.implementation.cache_tag` is not defined,
    :exc:`NotImplementedError` is raised.
 
index 09d5989c2f8b8407cf90b1abc3c0501025f29820..c6c7160a9d15331daac631fd7301287930caec7d 100644 (file)
@@ -1407,7 +1407,7 @@ an :term:`importer`.
    file path.  For example, if *path* is
    ``/foo/bar/__pycache__/baz.cpython-32.pyc`` the returned path would be
    ``/foo/bar/baz.py``.  *path* need not exist, however if it does not conform
-   to :pep:`3147` or :pep:`488` format, a ``ValueError`` is raised. If
+   to :pep:`3147` or :pep:`488` format, a :exc:`ValueError` is raised. If
    :attr:`sys.implementation.cache_tag` is not defined,
    :exc:`NotImplementedError` is raised.
 
index 98649de7310f0bf68d1bcba8a998c082946d4001..2536c37e772b8137198f73a35a7e12a11f7dc6a2 100644 (file)
@@ -39,7 +39,7 @@ pipe).
 
 All streams are careful about the type of data you give to them.  For example
 giving a :class:`str` object to the ``write()`` method of a binary stream
-will raise a ``TypeError``.  So will giving a :class:`bytes` object to the
+will raise a :exc:`TypeError`.  So will giving a :class:`bytes` object to the
 ``write()`` method of a text stream.
 
 .. versionchanged:: 3.3
index 379308c2af30f51d6ee2cf46069404802dc289ce..03644e2366592fadacd679a4fce147e4fe3ce639 100644 (file)
@@ -325,7 +325,7 @@ the :mod:`glob` module.)
    Normalize the case of a pathname.  On Unix and Mac OS X, this returns the
    path unchanged; on case-insensitive filesystems, it converts the path to
    lowercase.  On Windows, it also converts forward slashes to backward slashes.
-   Raise a TypeError if the type of *path* is not ``str`` or ``bytes`` (directly
+   Raise a :exc:`TypeError` if the type of *path* is not ``str`` or ``bytes`` (directly
    or indirectly through the :class:`os.PathLike` interface).
 
    .. versionchanged:: 3.6
index 5b0ef2e1d361cba8e8cc9b616ff88d3e2e432a61..4817bba7d4f2d2da442b3b804063ea21919a42f8 100644 (file)
@@ -1941,7 +1941,7 @@ to speed up repeated connections from the same clients.
    .. note::
       With versions of OpenSSL older than 0.9.8m, it is only possible
       to set options, not to clear them.  Attempting to clear an option
-      (by resetting the corresponding bits) will raise a ``ValueError``.
+      (by resetting the corresponding bits) will raise a :exc:`ValueError`.
 
    .. versionchanged:: 3.6
       :attr:`SSLContext.options` returns :class:`Options` flags:
index 268adc0c9de5bc3c4e608f4ef5f12def6d7f6841..9861da8d7073a52ae91c15b18baded84a8467e35 100644 (file)
@@ -899,7 +899,7 @@ The module defines the following classes, functions and decorators:
    non-``@overload``-decorated definition, while the latter is used at
    runtime but should be ignored by a type checker.  At runtime, calling
    a ``@overload``-decorated function directly will raise
-   ``NotImplementedError``. An example of overload that gives a more
+   :exc:`NotImplementedError`. An example of overload that gives a more
    precise type than can be expressed using a union or a type variable::
 
       @overload
index 83aee1b0262176eef767277b8e55698f77df19ba..b35a724fc5403a28df67662fa975049730408a6b 100644 (file)
@@ -1161,7 +1161,7 @@ Test cases
       If *delta* is supplied instead of *places* then the difference
       between *first* and *second* must be less or equal to (or greater than) *delta*.
 
-      Supplying both *delta* and *places* raises a ``TypeError``.
+      Supplying both *delta* and *places* raises a :exc:`TypeError`.
 
       .. versionchanged:: 3.2
          :meth:`assertAlmostEqual` automatically considers almost equal objects
index 95dc0f98ba513414af69b8d29838da5df7b36b17..b291d11595a89b7fd6bb790c0eca29e7f48d79b5 100644 (file)
@@ -41,7 +41,7 @@ objects:
    :noindex:
 
    Remove the first item from the list whose value is equal to *x*.  It raises a
-   ``ValueError`` if there is no such item.
+   :exc:`ValueError` if there is no such item.
 
 
 .. method:: list.pop([i])
index 4eddf841dcbec2b2f89ad10be0e9b15d46d55d23..b4540ac1dd9028db6b8cf873d2e64431c7a1080c 100644 (file)
@@ -593,7 +593,7 @@ a :term:`__future__` import is necessary::
     RuntimeError: generator raised StopIteration
 
 Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be
-raised whenever a ``StopIteration`` exception is raised inside a generator.
+raised whenever a :exc:`StopIteration` exception is raised inside a generator.
 
 .. seealso::
 
index bba16543686c55eebb86ca93c2b043a1225784eb..936ea2dc321e45711639dd04b5e4e63f8503c95a 100644 (file)
@@ -741,7 +741,7 @@ Some smaller changes made to the core Python language are:
 
 * A ``global`` or ``nonlocal`` statement must now textually appear
   before the first use of the affected name in the same scope.
-  Previously this was a ``SyntaxWarning``.
+  Previously this was a :exc:`SyntaxWarning`.
 
 * It is now possible to set a :ref:`special method <specialnames>` to
   ``None`` to indicate that the corresponding operation is not available.
index d4daf8f71f9ce2f2ea4e16556052aa0b19a08584..55cf74f7144957d775461964ddef098a2d7964de 100644 (file)
@@ -1030,7 +1030,7 @@ support the loading of resources from packages.  See also
 lacks a spec.
 (Contributed by Garvit Khatri in :issue:`29851`.)
 
-:func:`importlib.find_spec` now raises ``ModuleNotFoundError`` instead of
+:func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead of
 :exc:`AttributeError` if the specified parent module is not a package (i.e.
 lacks a ``__path__`` attribute).
 (Contributed by Milan Oberkirch in :issue:`30436`.)
diff --git a/Misc/NEWS.d/next/Documentation/2018-10-22-14-09-58.bpo-35044.qjvNtI.rst b/Misc/NEWS.d/next/Documentation/2018-10-22-14-09-58.bpo-35044.qjvNtI.rst
new file mode 100644 (file)
index 0000000..05e67e5
--- /dev/null
@@ -0,0 +1,2 @@
+Fix the documentation with the role ``exc`` for the appropriated exception. Patch by
+Stéphane Wirtel