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 vstinner
Recipients arigo, neologix, pitrou, vstinner
Date 2013-04-29.20:22:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwZ6VXNu1ZVsEw5nvxfbsCwxQPrR16Vm9J6p6OcSot-jUQ@mail.gmail.com>
In-reply-to <CAH_1eM1xWKxM0xnaWqqzgnXcToQHSpBboi7Y7XiUn=Pa0xetbQ@mail.gmail.com>
Content
>> It looks to be a feature of the standard C library, at least the GNU libc.
> Yes, it's guaranteed by POSIX/ANSI (see man exit).

Hum, POSIX (2004) is not so strict:
"Whether open streams are flushed or closed, or temporary files are
removed is implementation-defined."
http://pubs.opengroup.org/onlinepubs/009695399/functions/exit.html

2013/4/29 Charles-François Natali <report@bugs.python.org>:
>
> Charles-François Natali added the comment:
>
>> "When you say Python 2, I assume you mean CPython 2, right?
>> Because - AFAICT - files got flushed only by accident, not by design."
>>
>> It looks to be a feature of the standard C library, at least the GNU libc. Its libio library installs an exit handler flushing all open files. You can see it if you set a breaking on write() using gdb:
>
> Yes, it's guaranteed by POSIX/ANSI (see man exit).
> I was refering to the fact that the automatic flushing of files upon
> exit is a mere side effect of the implementation based atop stdio
> stream in cpython 2. It's no guaranteed by any Python spec (and I
> can't really think of any platform other than C that makes such
> guarantee).
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue17852>
> _______________________________________
History
Date User Action Args
2013-04-29 20:22:25vstinnersetrecipients: + vstinner, arigo, pitrou, neologix
2013-04-29 20:22:25vstinnerlinkissue17852 messages
2013-04-29 20:22:25vstinnercreate