cborutil: remove Python 2 definition of _elementtointeger()
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 01 Mar 2022 20:53:52 -0800
changeset 48942 bce8f66d3045
parent 48941 fd5b8e696b75
child 48943 70df51a2c2ce
cborutil: remove Python 2 definition of _elementtointeger() Differential Revision: https://phab.mercurial-scm.org/D12348
mercurial/utils/cborutil.py
--- a/mercurial/utils/cborutil.py	Mon Feb 21 12:42:48 2022 -0700
+++ b/mercurial/utils/cborutil.py	Tue Mar 01 20:53:52 2022 -0800
@@ -7,7 +7,6 @@
 
 
 import struct
-import sys
 
 
 # Very short very of RFC 7049...
@@ -246,16 +245,8 @@
     """Represents an error decoding CBOR."""
 
 
-if sys.version_info.major >= 3:
-
-    def _elementtointeger(b, i):
-        return b[i]
-
-
-else:
-
-    def _elementtointeger(b, i):
-        return ord(b[i])
+def _elementtointeger(b, i):
+    return b[i]
 
 
 STRUCT_BIG_UBYTE = struct.Struct('>B')