New submission from Poul-Henning Kamp: When a file is opened in append mode, the operating system guarantees that all write(2) system calls atomically appended their payload to the file.
At least on FreeBSD, Python breaks this guarantee, by chopping up large writes into multiple write(2) syscalls to the OS. Try running this program using ktrace/truss/strace or a similar system-call tracing facility: fo = open("/tmp/_bogus", "ab", 0) fo.write(bytearray(1024*1024)) fo.close() Instead of one single megabyte write, I see 1024 kilobyte writes. (BTW: Why only one kilobyte ? That is an incredible pessimisation these days...) I leave it to the python community to decide if this should be fixed, or merely pointed out in documentation (os.write() is a workaround) ---------- components: None messages: 168528 nosy: bsdphk priority: normal severity: normal status: open title: Python breaks OS' append guarantee on file writes type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15723> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com