[diffoscope] 01/02: Ensure that we pass str instances to our Difference class as paths, otherwise we can't be sure we can render them. For example, passing a class here breaks the HTML renderer.

Chris Lamb chris at chris-lamb.co.uk
Sun Aug 14 22:21:46 CEST 2016


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

lamby pushed a commit to branch master
in repository diffoscope.

commit b7830b5cb102580daf525a80bcf21e4572f8135f
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Aug 14 21:18:17 2016 +0100

    Ensure that we pass str instances to our Difference class as paths, otherwise we can't be sure we can render them. For example, passing a class here breaks the HTML renderer.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/difference.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/diffoscope/difference.py b/diffoscope/difference.py
index fed9381..d333061 100644
--- a/diffoscope/difference.py
+++ b/diffoscope/difference.py
@@ -290,6 +290,11 @@ class Difference(object):
         else:
             self._source1 = path1
             self._source2 = path2
+        # Ensure renderable types
+        if not isinstance(self._source1, str):
+            raise TypeError("path1/source[0] is not a string")
+        if not isinstance(self._source2, str):
+            raise TypeError("path2/source[1] is not a string")
         self._details = []
 
     def __repr__(self):

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


More information about the diffoscope mailing list