summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-05-18 01:24:35 (GMT)
committerGitHub <noreply@github.com>2022-05-18 01:24:35 (GMT)
commitb86d783a4eff96306f315acf9a6f1aca85d47fc3 (patch)
treeb10c87bbf6600f11ec3317b9529a1bb9b6868581 /Doc
parent33880b4b1c60f54aa9e7fa02698a3c82eafe3dc7 (diff)
downloadcpython-b86d783a4eff96306f315acf9a6f1aca85d47fc3.zip
cpython-b86d783a4eff96306f315acf9a6f1aca85d47fc3.tar.gz
cpython-b86d783a4eff96306f315acf9a6f1aca85d47fc3.tar.bz2
bpo-40838: document `getdoc`, `getmodule`, `getsourcefile` in `inspect` returns `None` (#30575)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/inspect.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 575b308..154d0f5 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -512,6 +512,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.
@@ -535,12 +536,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.