chiark / gitweb /
fshash.in: Use `binascii.hexlify' rather than `str.encode("hex")'.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 1 Jun 2024 03:24:08 +0000 (04:24 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 9 Jun 2024 11:10:59 +0000 (12:10 +0100)
The latter was a much better notation, so it was dropped from Python 3.

fshash.in

index 467cddda5fd40967057820cc5430c714b4948782..1f1a34d3b005e864c5a55fbfbd04bcd02d218880 100644 (file)
--- a/fshash.in
+++ b/fshash.in
@@ -24,6 +24,7 @@
 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 from sys import argv, exc_info, exit, stdin, stdout, stderr
 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 from sys import argv, exc_info, exit, stdin, stdout, stderr
+import binascii as B
 import errno as E
 import hashlib as H
 import optparse as OP
 import errno as E
 import hashlib as H
 import optparse as OP
@@ -301,7 +302,7 @@ class HashCache (object):
       fi.st = None
       fi.err = excval()
       return None
       fi.st = None
       fi.err = excval()
       return None
-    hash = hash.encode('hex')
+    hash = B.hexlify(hash)
 
     ## Insert a record into the database.
     if me._db:
 
     ## Insert a record into the database.
     if me._db: