summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
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 /Lib/imp.py
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 'Lib/imp.py')
-rw-r--r--Lib/imp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index f947c3d..dab8312 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -58,9 +58,12 @@ def source_from_cache(path):
The .pyc/.pyo file does not need to exist; this simply returns the path to
the .py file calculated to correspond to the .pyc/.pyo file. If path does
- not conform to PEP 3147 format, ValueError will be raised.
+ not conform to PEP 3147 format, ValueError will be raised. If
+ sys.implementation.cache_tag is None then NotImplementedError is raised.
"""
+ if sys.implementation.cache_tag is None:
+ raise NotImplementedError('sys.implementation.cache_tag is None')
head, pycache_filename = os.path.split(path)
head, pycache = os.path.split(head)
if pycache != _bootstrap._PYCACHE: