summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-16 22:37:53 (GMT)
committerBrett Cannon <brett@python.org>2013-06-16 22:37:53 (GMT)
commitf24fecd4ac9050799d02a8354b7acfa12b65b1d3 (patch)
tree332e7e70c73bfbe61754e95a173aadbbe6e004a4 /Doc/library/importlib.rst
parentf4375ef4d458bf24610ffef591f8197a3dbf0b35 (diff)
downloadcpython-f24fecd4ac9050799d02a8354b7acfa12b65b1d3.zip
cpython-f24fecd4ac9050799d02a8354b7acfa12b65b1d3.tar.gz
cpython-f24fecd4ac9050799d02a8354b7acfa12b65b1d3.tar.bz2
Issue #18076: Introduce imoportlib.util.decode_source().
The helper function makes it easier to implement imoprtlib.abc.InspectLoader.get_source() by making that function require just the raw bytes for source code and handling all other details.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index d7ed14b..ae0fe6b 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -916,6 +916,14 @@ an :term:`importer`.
.. versionadded:: 3.4
+.. function:: decode_source(source_bytes)
+
+ Decode the given bytes representing source code and return it as a string
+ with universal newlines (as required by
+ :meth:`importlib.abc.InspectLoader.get_source`).
+
+ .. versionadded:: 3.4
+
.. function:: resolve_name(name, package)
Resolve a relative module name to an absolute one.