[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Antoine Pitrou added the comment: Test broken on Windows: == FAIL: test_exceptions_propagate (test.test_py_compile.PyCompileTests) -- Traceback (most recent call last): File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_py_compile.py, line 66, in test_exceptions_propagate py_compile.compile(self.source_path, self.pyc_path) AssertionError: OSError not raised http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/1850/steps/test/logs/stdio -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Brett Cannon added the comment: Does os.chmod(self.directory, stat.S_IREAD) not work on directories on Windows? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Tim Golden added the comment: Essentially: no. The permissions system in Windows is very different from that of Unix. The CRT attempts to mimic it, but for things like read-onlyness, it does so by setting the (old-style DOS) attributes. These are only just meaningful for files, and are meaningless for directories. (Or, strictly, have a different meaning since ISTR the Explorer shell uses the readonly bit to indicate that a directory has some special significance). -- nosy: +tim.golden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Brett Cannon added the comment: Thanks for the info, Tim. I'll add a skip decorator to not run under Windows then. -- resolution: fixed - stage: committed/rejected - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Roundup Robot added the comment: New changeset 0803a28dca3c by Brett Cannon in branch 'default': Issue #17244: Windows doesn't let you set permissions on directories. http://hg.python.org/cpython/rev/0803a28dca3c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Changes by Brett Cannon br...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- stage: needs patch - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Roundup Robot added the comment: New changeset 04aaeae6ee7b by Brett Cannon in branch 'default': Issue #17244: Don't mask exceptions raised during the creation of http://hg.python.org/cpython/rev/04aaeae6ee7b -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Changes by Brett Cannon br...@python.org: -- resolution: - fixed stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Brett Cannon added the comment: I figured out what I have to do to make this work properly again to avoid the exception from being swallowed. Roughly: # XXX calculate mode (_cache_bytecode) # XXX create subdirectories as necessary (set_data) # XXX write file (_write_atomic) # Above replaces loader._cache_bytecode(file, cfile, bytecode) That will bypass the try/except block causing the issues. -- assignee: - brett.cannon stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
New submission from Arfrever Frehtes Taifersar Arahesis: 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 $ -- components: Library (Lib) messages: 182426 nosy: Arfrever, brett.cannon, eric.snow, ncoghlan, pitrou priority: normal severity: normal status: open title: py_compile.compile() fails to raise exceptions when writing of target file fails type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails
Brett Cannon added the comment: It's because of this try/except to silence failed bytecode creation: http://hg.python.org/cpython/file/d404d33a999c/Lib/importlib/_bootstrap.py#l1105 I hate the py_compile module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com