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 eryksun
Recipients Lauri Kajan, eryksun, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2015-09-21.15:54:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442850878.59.0.539219655723.issue25202@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-09-21 15:54:38eryksunsetrecipients: + eryksun, paul.moore, vstinner, tim.golden, zach.ware, steve.dower, Lauri Kajan
2015-09-21 15:54:38eryksunsetmessageid: <1442850878.59.0.539219655723.issue25202@psf.upfronthosting.co.za>
2015-09-21 15:54:38eryksunlinkissue25202 messages
2015-09-21 15:54:38eryksuncreate