]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (#101689)
authorNikita Sobolev <mail@sobolevn.me>
Thu, 23 Mar 2023 19:35:02 +0000 (22:35 +0300)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2023 19:35:02 +0000 (19:35 +0000)
Doc/library/inspect.rst

index ccf240193d36a9ebd64844657f0fc9bdadb35409..88f843c03b1d5a7e8c2de0941d00c25d13cde8ce 100644 (file)
@@ -574,6 +574,8 @@ Retrieving source code
    object and the line number indicates where in the original source file the first
    line of code was found.  An :exc:`OSError` is raised if the source code cannot
    be retrieved.
+   A :exc:`TypeError` is raised if the object is a built-in module, class, or
+   function.
 
    .. versionchanged:: 3.3
       :exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
@@ -586,6 +588,8 @@ Retrieving source code
    class, method, function, traceback, frame, or code object.  The source code is
    returned as a single string.  An :exc:`OSError` is raised if the source code
    cannot be retrieved.
+   A :exc:`TypeError` is raised if the object is a built-in module, class, or
+   function.
 
    .. versionchanged:: 3.3
       :exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the