[master] ddaa6e5e7 Fix vmodtool with python3

Bernhard M. Wiedemann bwiedemann at suse.de
Mon Sep 3 10:05:15 UTC 2018


commit ddaa6e5e73bfe7198d344fb0d0c4f6510151c4cc
Author: Bernhard M. Wiedemann <bwiedemann at suse.de>
Date:   Mon Sep 3 11:58:14 2018 +0200

    Fix vmodtool with python3
    
    Without this patch, it did
    TypeError: Unicode-objects must be encoded before hashing
    
    Fixes: #2436

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 4b25dc623..3032f380f 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -859,7 +859,7 @@ class vcc(object):
     def parse(self):
         global inputline
         a = "\n" + open(self.inputfile, "r").read()
-        self.file_id = hashlib.sha256(a).hexdigest()
+        self.file_id = hashlib.sha256(a.encode('utf-8')).hexdigest()
         s = a.split("\n$")
         self.copyright = s.pop(0).strip()
         while s:


More information about the varnish-commit mailing list