Skip to content

Commit

Permalink
gh-98239: Document that inspect.getsource() can raise TypeError (G…
Browse files Browse the repository at this point in the history
…H-101689)

(cherry picked from commit b613208)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn committed Mar 23, 2023
1 parent 6c667d0 commit 77e54fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,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
Expand All @@ -538,6 +540,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
Expand Down

0 comments on commit 77e54fe

Please sign in to comment.