8000 gh-98239: Document that `inspect.getsource()` can raise `TypeError` (… · Fidget-Spinner/cpython@c25402d · GitHub
[go: up one dir, main page]

Skip to content

Commit c25402d

Browse files
sobolevnFidget-Spinner
authored andcommitted
pythongh-98239: Document that inspect.getsource() can raise TypeError (python#101689)
1 parent 10b47a8 commit c25402d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/inspect.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ Retrieving source code
574574
object and the line number indicates where in the original source file the first
575575
line of code was found. An :exc:`OSError` is raised if the source code cannot
576576
be retrieved.
577+
A :exc:`TypeError` is raised if the object is a built-in module, class, or
578+
function.
577579

578580
.. versionchanged:: 3.3
579581
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
@@ -586,6 +588,8 @@ Retrieving source code
586588
class, method, function, traceback, frame, or code object. The source code is
587589
returned as a single string. An :exc:`OSError` is raised if the source code
588590
cannot be retrieved.
591+
A :exc:`TypeError` is raised if the object is a built-in module, class, or
592+
function.
589593

590594
.. versionchanged:: 3.3
591595
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the

0 commit comments

Comments
 (0)
0