Martin Panter added the comment:

Thanks for the strace output. I think the actual error is the fstat() call a 
bit after that first open() call. FileNotFoundError is ENOENT:

open("/vagrant/tmpy5ioznh4", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC, 0600) 
= 4
unlink("/vagrant/tmpy5ioznh4")          = 0
fstat(4, 0x7ffc0b326520)                = -1 ENOENT (No such file or directory)
close(4)                                = 0
write(2, "Traceback (most recent call last"..., 35Traceback (most recent call 
last):

My theory is that the fstat() call at 
<https://hg.python.org/cpython/annotate/3.5/Modules/_io/fileio.c#l441> is 
failing, probably because the file entry has been removed from its directory. 
This call was added by revision 3b5279b5bfd1 (Issue 21679). Before this change, 
fstat() was called twice, but in each case an error was tolerated.

Posix does not mention fstat() returning this ENOENT error, so maybe this could 
be a bug with the Virtual Box or Vagrant driver for the mounted filesystem. But 
it might be nice to make Python more permissive if fstat() fails, like it was 
in 3.4.

As a workaround, you may be able to use NamedTemporaryFile, if you are happy 
for the file to have a name and a directory entry.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25717>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to