Merge branch 'pr/3719' into maintenance

This commit is contained in:
Gina Häußge committed 2020-09-14 12:44:02 +02:00
commit b80826dd0c
2 files changed
+73 -8

No files matched your search

+3 -1
View File
@@ -1067,9 +1067,11 @@ def atomic_write(filename, mode="w+b", encoding="utf-8", prefix="tmp", suffix=""
if os.path.exists(filename):
permissions |= os.stat(filename).st_mode
permissions &= max_permissions
targetdirectory = os.path.dirname(filename)
# NamedTemporaryFile doesn't yet have an encoding parameter in py2, so we go the long way
fd, path = tempfile.mkstemp(suffix=suffix, prefix=prefix)
fd, path = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=targetdirectory)
os.close(fd)
if "b" in mode: