[Reproducible-commits] [diffoscope] 14/21: Open devices and symlink placeholders in text mode

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Sep 21 17:39:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository diffoscope.

commit 5b2999016df670054665cd95f3c1cac3723b9141
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sun Sep 20 00:12:09 2015 +0200

    Open devices and symlink placeholders in text mode
    
    NameTemporaryFile default mode is 'w+b'. We want to open the file as text,
    so we need to specify the mode.
    
    This is required for Python 3 as we are writing the content with unicode
    strings and not bytes.
---
 diffoscope/comparators/device.py  | 2 +-
 diffoscope/comparators/symlink.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/device.py b/diffoscope/comparators/device.py
index e95a02b..52b3268 100644
--- a/diffoscope/comparators/device.py
+++ b/diffoscope/comparators/device.py
@@ -41,7 +41,7 @@ class Device(File):
 
     @contextmanager
     def get_content(self):
-        with tempfile.NamedTemporaryFile(suffix='diffoscope') as f:
+        with tempfile.NamedTemporaryFile(mode='w+', suffix='diffoscope') as f:
             f.write(format_device(*self.get_device()))
             f.flush()
             self._path = f.name
diff --git a/diffoscope/comparators/symlink.py b/diffoscope/comparators/symlink.py
index aa50372..4451d28 100644
--- a/diffoscope/comparators/symlink.py
+++ b/diffoscope/comparators/symlink.py
@@ -37,7 +37,7 @@ class Symlink(File):
 
     @contextmanager
     def get_content(self):
-        with tempfile.NamedTemporaryFile(suffix='diffoscope') as f:
+        with tempfile.NamedTemporaryFile('w+', suffix='diffoscope') as f:
             f.write(format_symlink(self.symlink_destination))
             f.flush()
             self._path = f.name

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list