Patchwork D12348: cborutil: remove Python 2 definition of _elementtointeger()

login
register
mail settings
Submitter phabricator
Date March 4, 2022, 3:33 a.m.
Message ID <differential-rev-PHID-DREV-vmryfxdpksshzkyaquwp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50687/
State New
Headers show

Comments

phabricator - March 4, 2022, 3:33 a.m.
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12348

AFFECTED FILES
  mercurial/utils/cborutil.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py
--- a/mercurial/utils/cborutil.py
+++ b/mercurial/utils/cborutil.py
@@ -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')