8000 [3.10] gh-85015: document `getdoc`, `getmodule`, `getsourcefile` in `inspect` returns `None` (GH-30575) by miss-islington · Pull Request #92910 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.10] gh-85015: document getdoc, getmodule, getsourcefile in inspect returns None (GH-30575) #92910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ Retrieving source code
If the documentation string for an object is not provided and the object is
a class, a method, a property or a descriptor, retrieve the documentation
string from the inheritance hierarchy.
Return ``None`` if the documentation string is invalid or missing.

.. versionchanged:: 3.5
Documentation strings are now inherited if not overridden.
Expand All @@ -505,12 +506,14 @@ Retrieving source code

.. function:: getmodule(object)

Try to guess which module an object was defined in.
Try to guess which module an object was defined in. Return ``None``
if the module cannot be determined.


.. function:: getsourcefile(object)

Return the name of the Python source file in which an object was defined. This
Return the name of the Python source file in which an object was defined
or ``None`` if no way can be identified to get the source. This
will fail with a :exc:`TypeError` if the object is a built-in module, class, or
function.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document that :func:`inspect.getdoc`, :func:`inspect.getmodule`, and
:func:`inspect.getsourcefile` might return ``None``.
0