[python-debian/master 25/36] Encode Unicode strings before passing them to hashlib.sha1().

Colin Watson cjwatson at canonical.com
Mon Oct 8 07:41:23 UTC 2012


---
 lib/debian/debian_support.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
index dcffddf..8a72d63 100644
--- a/lib/debian/debian_support.py
+++ b/lib/debian/debian_support.py
@@ -415,7 +415,10 @@ del list_releases
 def read_lines_sha1(lines):
     m = hashlib.sha1()
     for l in lines:
-        m.update(l)
+        if isinstance(l, bytes):
+            m.update(l)
+        else:
+            m.update(l.encode("UTF-8"))
     return m.hexdigest()
 
 readLinesSHA1 = function_deprecated_by(read_lines_sha1)
-- 
1.7.2.5





More information about the pkg-python-debian-commits mailing list