summaryrefslogtreecommitdiffstats
path: root/Doc/library/inspect.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-07-18 13:14:57 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-07-18 13:14:57 (GMT)
commit76e077001d9c593faaec1aa5187dd7870cb4481c (patch)
tree8ac59cf5a5321a0cef8cdf56a4681cf46969cb73 /Doc/library/inspect.rst
parent90db661b4335eaf7a3cb5e9a4524ae9707eeaf76 (diff)
downloadcpython-76e077001d9c593faaec1aa5187dd7870cb4481c.zip
cpython-76e077001d9c593faaec1aa5187dd7870cb4481c.tar.gz
cpython-76e077001d9c593faaec1aa5187dd7870cb4481c.tar.bz2
Close #15387: inspect.getmodulename() now uses a new importlib.machinery.all_suffixes() API rather than the deprecated inspect.getmoduleinfo()
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r--Doc/library/inspect.rst15
1 files changed, 12 insertions, 3 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 6568e94..ac0d6e6 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -198,9 +198,18 @@ attributes:
.. function:: getmodulename(path)
Return the name of the module named by the file *path*, without including the
- names of enclosing packages. This uses the same algorithm as the interpreter
- uses when searching for modules. If the name cannot be matched according to the
- interpreter's rules, ``None`` is returned.
+ names of enclosing packages. The file extension is checked against all of
+ the entries in :func:`importlib.machinery.all_suffixes`. If it matches,
+ the final path component is returned with the extension removed.
+ Otherwise, ``None`` is returned.
+
+ Note that this function *only* returns a meaningful name for actual
+ Python modules - paths that potentially refer to Python packages will
+ still return ``None``.
+
+ .. versionchanged:: 3.3
+ This function is now based directly on :mod:`importlib` rather than the
+ deprecated :func:`getmoduleinfo`.
.. function:: ismodule(object)