diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-03-23 19:35:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 19:35:02 (GMT) |
commit | b6132085ca5418f714eff6e31d1d03369d3fd1d9 (patch) | |
tree | 37c477757efa23f5df78c20ddfc35a3ba63e5dfd /Doc/library/inspect.rst | |
parent | 58d2b30c012c3a9fe5ab747ae47c96af09e0fd15 (diff) | |
download | cpython-b6132085ca5418f714eff6e31d1d03369d3fd1d9.zip cpython-b6132085ca5418f714eff6e31d1d03369d3fd1d9.tar.gz cpython-b6132085ca5418f714eff6e31d1d03369d3fd1d9.tar.bz2 |
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (#101689)
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r-- | Doc/library/inspect.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index ccf2401..88f843c 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -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 |