Merge branch 'pr/3719' into maintenance
This commit is contained in:
commit
b80826dd0c
2 files changed
+73
-8
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user