Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] best place for an atomic file API

"Martin v. Löwis"martin at v.loewis.de
Thu Feb 16 10:08:30 CET 2012


> (MvL complained in the tracker issue about a lack of concrete use> cases, but I think fixing race conditions when overwriting bytecode> files in importlib and the existing distutils/packaging use cases> cover that)I certainly agree that there are applications of "atomic replace", andthat the os module should expose the relevant platform APIs whereavailable.I'm not so sure that "atomic writes" is a useful concept. I haven't seena proposed implementation, yet, but I'm doubtful that truly ACIDwrites are possible unless the operating system supports transactions(which only Windows 7 does). Even if you are ignoring Isolation,Atomic already is a challenge: if you first write to a tempfile, thenrename it, you may end up with a state tempfile (e.g. if the processis killed), and no rollback operation.So "atomic write" to me promises something that it likely can'tdeliver. OTOH, I still think that the promise isn't actually askedfor in practice (not even when overwriting bytecode files)Regards,Martin


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp