WhirlpoolAdd: raise TypeError if not bytes
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Aug 2012 19:26:25 +0000 (12:26 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Aug 2012 19:26:25 +0000 (12:26 -0700)
pym/portage/util/whirlpool.py

index c696f6fc009fbf50a5efa74f4d6627587a388fad..170ae73f804ee15b571debd276092d60562b77e9 100644 (file)
@@ -639,6 +639,8 @@ def WhirlpoolInit(ctx):
     return
 
 def WhirlpoolAdd(source, sourceBits, ctx):
+    if not isinstance(source, bytes):
+        raise TypeError("Expected %s, got %s" % (bytes, type(source)))
     if sys.hexversion < 0x3000000:
         source = [ord(s)&0xff for s in source]