For python-3.0 compatibility, encode strings as binary before trying to pass
authorZac Medico <zmedico@gentoo.org>
Thu, 19 Feb 2009 11:41:48 +0000 (11:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 19 Feb 2009 11:41:48 +0000 (11:41 -0000)
them to hashlib.

svn path=/main/trunk/; revision=12645

pym/portage/dbapi/vartree.py

index 14c5360e2b4211bb9c4451c6cc7e776a02dba174..f2d0d1a77865d08754019c1b286f7824413be76c 100644 (file)
@@ -787,7 +787,7 @@ class vardbapi(dbapi):
                                counter, = self.aux_get(cpv, aux_keys)
                        except KeyError:
                                continue
-                       h.update(counter)
+                       h.update(counter.encode())
                return h.hexdigest()
 
        def cpv_inject(self, mycpv):
@@ -1378,7 +1378,7 @@ class vardbapi(dbapi):
 
                def _hash_str(self, s):
                        h = self._new_hash()
-                       h.update(s)
+                       h.update(s.encode())
                        h = h.hexdigest()
                        h = h[-self._hex_chars:]
                        h = int(h, 16)