[New-bugs-announce] [issue16597] close not being called with context manager on IOError when device is full.

John-John Tedro report at bugs.python.org
Mon Dec 3 00:24:53 CET 2012


New submission from John-John Tedro:

In 3.2.2 and 3.2.3 on linux64, when running the following code. 

    try:
        print("Writing to /dev/full")

        with open("/dev/full", "w") as f:
             f.write("Write to full device")
    except:
        print("Catch, file closed?")

Using

    strace -e close ~/usr/python3.2.3/bin/python3 test.py
    ...
    Writing to /dev/full
    Catch, file closed?
    close(3)                                = 0

The file descriptor being used (3) to attempt writing to /dev/full is not closed until the process exits.

I expected this to be closed when leaving the context manager.

----------
components: IO
messages: 176816
nosy: udoprog
priority: normal
severity: normal
status: open
title: close not being called with context manager on IOError when device is full.
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16597>
_______________________________________


More information about the New-bugs-announce mailing list