New submission from David Pritchard:
In importlib/_bootstrap.py, there is a function _fill_cache which crashes when
you try to run Python in any environment that is so restricted that write
permissions are not allowed. You get a trace like:
Traceback (most recent call last):
In line:
[the import statement]
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1516, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1470, in _find_module
File "<frozen importlib._bootstrap>", line 1305, in find_module
File "<frozen importlib._bootstrap>", line 1284, in _get_loader
File "<frozen importlib._bootstrap>", line 1356, in find_loader
File "<frozen importlib._bootstrap>", line 1392, in _fill_cache
PermissionError: [Errno 13] Permission denied: '[the directory name]'
This was not an issue when I was using Python 3.2 and I suspect it has to do
with the OS error refactoring. I believe it can be fixed with a two-line patch,
attached. (Sorry if it is the wrong format, it's the first one I've submitted.)
The patch simply treats the case of PermissionError the same was as it does
when there is a FileNotFoundError. I've tested the patch and it fixes the
problem.
----------
components: Interpreter Core
files: _bootstrap.py.patch
keywords: patch
messages: 177745
nosy: David.Pritchard
priority: normal
severity: normal
status: open
title: _fill_cache in _bootstrap.py crashes without directory execute
permissions
versions: Python 3.3
Added file: http://bugs.python.org/file28359/_bootstrap.py.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16730>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com