From 1e7cce51d54592b631e4c4500d27dd4845176bcf Mon Sep 17 00:00:00 2001 From: Glen Walker Date: Fri, 1 Feb 2019 23:37:30 +1300 Subject: [PATCH 1/2] Restore ability to use tempfile kwargs other than dir (#40) The changes in #38 broke the ability to use prefix, suffix and bufsize arguments when creating the tempfile. This commit restores the ability. --- atomicwrites/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atomicwrites/__init__.py b/atomicwrites/__init__.py index 768e2ae..c2132d0 100644 --- a/atomicwrites/__init__.py +++ b/atomicwrites/__init__.py @@ -165,11 +165,13 @@ def _open(self, get_fileobject): except Exception: pass - def get_fileobject(self, dir=None, **kwargs): + def get_fileobject(self, suffix="", prefix=tempfile.template, dir=None, + **kwargs): '''Return the temporary file to use.''' if dir is None: dir = os.path.normpath(os.path.dirname(self._path)) - descriptor, name = tempfile.mkstemp(dir=dir) + descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, + dir=dir) # io.open() will take either the descriptor or the name, but we need # the name later for commit()/replace_atomic() and couldn't find a way # to get the filename from the descriptor. From 890e7aed4a1fd3b3724dc64503757617996c3978 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 1 Feb 2019 11:38:06 +0100 Subject: [PATCH 2/2] Version 1.3.0 --- atomicwrites/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomicwrites/__init__.py b/atomicwrites/__init__.py index c2132d0..cfa5c29 100644 --- a/atomicwrites/__init__.py +++ b/atomicwrites/__init__.py @@ -9,7 +9,7 @@ except ImportError: fcntl = None -__version__ = '1.2.1' +__version__ = '1.3.0' PY2 = sys.version_info[0] == 2