[Python-checkins] cpython: utilize int.from_bytes

philip.jenvey python-checkins at python.org
Fri Aug 30 03:35:00 CEST 2013


http://hg.python.org/cpython/rev/c347b9063a9e
changeset:   85460:c347b9063a9e
user:        Philip Jenvey <pjenvey at underboss.org>
date:        Thu Aug 29 18:33:50 2013 -0700
summary:
  utilize int.from_bytes

files:
  Lib/uuid.py |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Lib/uuid.py b/Lib/uuid.py
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -147,7 +147,7 @@
             if len(bytes) != 16:
                 raise ValueError('bytes is not a 16-char string')
             assert isinstance(bytes, bytes_), repr(bytes)
-            int = int_(('%02x'*16) % tuple(bytes), 16)
+            int = int_.from_bytes(bytes, byteorder='big')
         if fields is not None:
             if len(fields) != 6:
                 raise ValueError('fields is not a 6-tuple')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list