summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-03-23 19:41:50 (GMT)
committerGitHub <noreply@github.com>2023-03-23 19:41:50 (GMT)
commit77e54fe98a52a70e7d692d4765821e66e9c40b4a (patch)
tree2b074f8459a7c96d0939402a369d28724c533784 /Doc
parent6c667d025a1bea6d897006d556878f59f651243f (diff)
downloadcpython-77e54fe98a52a70e7d692d4765821e66e9c40b4a.zip
cpython-77e54fe98a52a70e7d692d4765821e66e9c40b4a.tar.gz
cpython-77e54fe98a52a70e7d692d4765821e66e9c40b4a.tar.bz2
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (GH-101689)
(cherry picked from commit b6132085ca5418f714eff6e31d1d03369d3fd1d9) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/inspect.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 35aa994..0fe4fb6 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -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
@@ -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