Mercurial > cpython-lru_cache-weakref
diff Lib/mailbox.py @ 77851:13fb85ef0eea 3.2
#5346: Preserve permissions of mbox, MMDF and Babyl mailbox files on flush()
| author | Petri Lehtinen <petri@digip.org> |
|---|---|
| date | Fri, 29 Jun 2012 15:09:12 +0300 |
| parents | 7cf5a629fde2 |
| children | cbc1dc8cda06 23beb7f8561a |
line wrap: on
line diff
--- a/Lib/mailbox.py Fri Jun 29 13:43:37 2012 +0300 +++ b/Lib/mailbox.py Fri Jun 29 15:09:12 2012 +0300 @@ -691,6 +691,9 @@ _sync_close(new_file) # self._file is about to get replaced, so no need to sync. self._file.close() + # Make sure the new file's mode is the same as the old file's + mode = os.stat(self._path).st_mode + os.chmod(new_file.name, mode) try: os.rename(new_file.name, self._path) except OSError as e:
