eryksun added the comment:

Lauri changed the version from 3.4 to 3.2, and I was able to reproduce the 
problem in 3.2.5:

    C:\Temp>py -3.2 --version
    Python 3.2.5
    C:\Temp>py -3.2 nospace.py
    removing fill.txt
    Traceback (most recent call last):
      File "nospace.py", line 8, in <module>
        n = f.write(b"\0")
    IOError: [Errno 28] No space left on device

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "nospace.py", line 8, in <module>
        n = f.write(b"\0")
    IOError: [Errno 28] No space left on device

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "nospace.py", line 12, in <module>
        os.remove(fill)
    WindowsError: [Error 32] The process cannot access the file because it is 
    being used by another process: 'T:\\fill.txt'

It's a sharing violation, since the file handle isn't closed and wasn't opened 
with FILE_SHARE_DELETE.

There's no problem in 3.4 or 3.5 since it properly closes the file handle even 
if flush() fails:

    C:\Temp>py -3.4 --version
    Python 3.4.3
    C:\Temp>py -3.4 nospace.py
    removing fill.txt

    C:\Temp>py -3.5 --version
    Python 3.5.0
    C:\Temp>py -3.5 nospace.py
    removing fill.txt

----------

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

Reply via email to