Python 3.x tempfile requires unicode
Explicitly encode the output of yaml dump, and allow tempfile to handle the unicode output as it works correctly for python 2.7 and 3.x+ Change-Id: I919b2565a7f3857586ee6cc09b787160472e9deb
This commit is contained in:
parent
008082568c
commit
7d13236760
@ -105,7 +105,7 @@ class CacheStorage(object):
|
||||
# issues around corruption such the process be killed
|
||||
tfile = self._tempfile.NamedTemporaryFile(dir=self.get_cache_dir(),
|
||||
delete=False)
|
||||
self._yaml.dump(self.data, utils.wrap_stream(tfile))
|
||||
tfile.write(self._yaml.dump(self.data).encode('utf-8'))
|
||||
# force contents to be synced on disk before overwriting cachefile
|
||||
tfile.flush()
|
||||
self._os.fsync(tfile.fileno())
|
||||
|
Loading…
x
Reference in New Issue
Block a user