Low level file descriptors and high-level Python files
lac at openend.se
Wed Sep 2 09:02:24 CEST 2015
In a message of Tue, 01 Sep 2015 22:19:15 -0000, Grant Edwards writes:
>On 2015-09-01, Laura Creighton <lac at openend.se> wrote:
>> Don't go around closing things you don't know are open. They
>> could be some other processes' thing.
>I don't understand. Closing a file descriptor that isn't open is
>harmless, isn't it? Closing one that _is_ open only affects the
>current process. If other processes had the same fd open, it's still
>open for them.
>Grant Edwards grant.b.edwards Yow! FUN is never having to
> at say you're SUSHI!!
This is me being tired and not saying things properly. What I meant was
don't go around closing mkstemp files thinking you can reopen them later,
because in between the time you use mkstemp to make the file and you open
it up again later somebody else may have replaced that file. Including
some other program running mkstemp which was desparate to make the exact same
filename you did. But that's not what I said ... so thank you.
More information about the Python-list