8000 gh-98239: Document that `inspect.getsource()` can raise `TypeError` by sobolevn · Pull Request #101689 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-98239: Document that inspect.getsource() can raise TypeError #101689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
0