[Python-checkins] gh-98239: Document that `inspect.getsource()` can raise `TypeError` (GH-101689)
miss-islington
webhook-mailer at python.org
Thu Mar 23 15:43:02 EDT 2023
https://github.com/python/cpython/commit/202e16ea050eaa34a328f281d24f8a0e662be463
commit: 202e16ea050eaa34a328f281d24f8a0e662be463
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-03-23T12:42:54-07:00
summary:
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (GH-101689)
(cherry picked from commit b6132085ca5418f714eff6e31d1d03369d3fd1d9)
Co-authored-by: Nikita Sobolev <mail at sobolevn.me>
files:
M Doc/library/inspect.rst
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index caca1050d7bf..932e52816413 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -553,6 +553,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
@@ -565,6 +567,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
More information about the Python-checkins
mailing list