This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arfrever
Recipients Arfrever, brett.cannon, eric.snow, ncoghlan, pitrou
Date 2013-02-19.20:47:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1361306836.21.0.240059339462.issue17244@psf.upfronthosting.co.za>
In-reply-to
Content
Since d4eb02b6aac9 py_compile.compile() fails to raise exceptions when writing of target file fails.

$ cd /tmp
$ touch test.py
$ mkdir dir
$ chmod a-w dir
mode of ‘dir’ changed from 0755 (rwxr-xr-x) to 0555 (r-xr-xr-x)
$ python3.3 -c 'import py_compile; py_compile.compile("test.py", cfile="/tmp/dir/test.pyc")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.3/py_compile.py", line 141, in compile
    with open(cfile, 'wb') as fc:
PermissionError: [Errno 13] Permission denied: '/tmp/dir/test.pyc'
$ python3.4 -c 'import py_compile; py_compile.compile("test.py", cfile="/tmp/dir/test.pyc")'
$ python3.3 -c 'import py_compile; py_compile.compile("test.py", cfile="/tmp/dir")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.3/py_compile.py", line 141, in compile
    with open(cfile, 'wb') as fc:
IsADirectoryError: [Errno 21] Is a directory: '/tmp/dir'
$ python3.4 -c 'import py_compile; py_compile.compile("test.py", cfile="/tmp/dir")'
$ ls -l dir
total 0
$
History
Date User Action Args
2013-02-19 20:47:16Arfreversetrecipients: + Arfrever, brett.cannon, ncoghlan, pitrou, eric.snow
2013-02-19 20:47:16Arfreversetmessageid: <1361306836.21.0.240059339462.issue17244@psf.upfronthosting.co.za>
2013-02-19 20:47:16Arfreverlinkissue17244 messages
2013-02-19 20:47:15Arfrevercreate