mirror of
https://github.com/python/cpython.git
synced 2025-09-28 11:15:17 +00:00
gh-98239: Document that inspect.getsource()
can raise TypeError
(#101689)
This commit is contained in:
parent
58d2b30c01
commit
b6132085ca
1 changed files with 4 additions and 0 deletions
|
@ -574,6 +574,8 @@ Retrieving source code
|
||||||
object and the line number indicates where in the original source file the first
|
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
|
line of code was found. An :exc:`OSError` is raised if the source code cannot
|
||||||
be retrieved.
|
be retrieved.
|
||||||
|
A :exc:`TypeError` is raised if the object is a built-in module, class, or
|
||||||
|
function.
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
|
: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
|
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
|
returned as a single string. An :exc:`OSError` is raised if the source code
|
||||||
cannot be retrieved.
|
cannot be retrieved.
|
||||||
|
A :exc:`TypeError` is raised if the object is a built-in module, class, or
|
||||||
|
function.
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
|
:exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue