Message328029
Hi,
This is the first issue I submit so please correct me if I do anything wrong.
Description of the issue:
imporlib logs 'wrote <path to .pyc file>' even when file creation fails with OSError (for lack of write persmission for example)
Reproducing the bug in Python 3.6 on ubuntu 16.04:
cd /home/quentin/tmp
mkdir __pycache__
chmod -R -w __pycache__
echo '1 + 1' > spam.py
python -vv -c'import spam' 2>&1 | grep '__pycache__/spam'
Output:
# could not create '/home/quentin/tmp/__pycache__/spam.cpython-36.pyc': PermissionError(13, 'Permission denied')
# wrote '/home/quentin/tmp/__pycache__/spam.cpython-36.pyc'
Reason:
SourceFileLoader.set_data() silences OSError raised by _write_atomic (importlib/_bootstrap_external.py line 875)
Then SourceLoader.get_code() does not see that something went awry and logs file creation (same file, line 789)
If it is worth fixing I would be glad to contribute a patch, but would probably need a little guidance. |
|
Date |
User |
Action |
Args |
2018-10-19 04:00:41 | qagren | set | recipients:
+ qagren |
2018-10-19 04:00:41 | qagren | set | messageid: <1539921641.62.0.788709270274.issue35024@psf.upfronthosting.co.za> |
2018-10-19 04:00:41 | qagren | link | issue35024 messages |
2018-10-19 04:00:41 | qagren | create | |
|