summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-07-09 17:58:07 (GMT)
committerBrett Cannon <brett@python.org>2012-07-09 17:58:07 (GMT)
commit19a2f5961ce235e9ca9944069b0f5f21b340de9c (patch)
treec6d4a0a02d2eff9004046b5b3b478722431d43c5 /Doc/library
parentbf7eab077fe146dd76f5e7ddad3ff8b2d271fe6c (diff)
downloadcpython-19a2f5961ce235e9ca9944069b0f5f21b340de9c.zip
cpython-19a2f5961ce235e9ca9944069b0f5f21b340de9c.tar.gz
cpython-19a2f5961ce235e9ca9944069b0f5f21b340de9c.tar.bz2
Issue #15056: imp.cache_from_source() and source_from_cache() raise
NotimplementedError when sys.implementation.cache_tag is None. Thanks to Pranav Ravichandran for taking an initial stab at the patch.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/imp.rst21
1 files changed, 18 insertions, 3 deletions
diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst
index 3e79936..43d740b 100644
--- a/Doc/library/imp.rst
+++ b/Doc/library/imp.rst
@@ -180,14 +180,19 @@ file paths.
source *path*. For example, if *path* is ``/foo/bar/baz.py`` the return
value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python 3.2.
The ``cpython-32`` string comes from the current magic tag (see
- :func:`get_tag`). The returned path will end in ``.pyc`` when
- ``__debug__`` is True or ``.pyo`` for an optimized Python
+ :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then
+ :exc:`NotImplementedError` will be raised). The returned path will end in
+ ``.pyc`` when ``__debug__`` is True or ``.pyo`` for an optimized Python
(i.e. ``__debug__`` is False). By passing in True or False for
*debug_override* you can override the system's value for ``__debug__`` for
extension selection.
*path* need not exist.
+ .. versionchanged:: 3.3
+ If :attr:`sys.implementation.cache_tag` is ``None``, then
+ :exc:`NotImplementedError` is raised.
+
.. function:: source_from_cache(path)
@@ -195,7 +200,13 @@ file paths.
file path. For example, if *path* is
``/foo/bar/__pycache__/baz.cpython-32.pyc`` the returned path would be
``/foo/bar/baz.py``. *path* need not exist, however if it does not conform
- to :pep:`3147` format, a ``ValueError`` is raised.
+ to :pep:`3147` format, a ``ValueError`` is raised. If
+ :attr:`sys.implementation.cache_tag` is not defined,
+ :exc:`NotImplementedError` is raised.
+
+ .. versionchanged:: 3.3
+ Raise :exc:`NotImplementedError` when
+ :attr:`sys.implementation.cache_tag` is not defined.
.. function:: get_tag()
@@ -203,6 +214,10 @@ file paths.
Return the :pep:`3147` magic tag string matching this version of Python's
magic number, as returned by :func:`get_magic`.
+ .. note::
+ You may use :attr:`sys.implementation.cache_tag` directly starting
+ in Python 3.3.
+
The following functions help interact with the import system's internal
locking mechanism. Locking semantics of imports are an implementation