[Patch #1599256 from David Watson] check that os.fsync is available before using it

This commit is contained in:
Andrew M. Kuchling 2006-12-14 18:57:53 +00:00
parent 76fdb8c050
commit 1646568b5e
1 changed files with 2 additions and 1 deletions

View File

@ -1887,7 +1887,8 @@ def _create_temporary(path):
def _sync_flush(f):
"""Ensure changes to file f are physically on disk."""
f.flush()
os.fsync(f.fileno())
if hasattr(os, 'fsync'):
os.fsync(f.fileno())
def _sync_close(f):
"""Close file f, ensuring all changes are physically on disk."""