hgext/fsmonitor/pywatchman/pybser.py
changeset 49848 139f713010ea
parent 49537 f58f955adad4
child 51859 f4733654f144
--- a/hgext/fsmonitor/pywatchman/pybser.py	Wed Jan 04 17:15:19 2023 -0500
+++ b/hgext/fsmonitor/pywatchman/pybser.py	Thu Jan 05 00:09:48 2023 -0500
@@ -51,17 +51,15 @@
 BSER_SKIP = b"\x0c"
 BSER_UTF8STRING = b"\x0d"
 
-if compat.PYTHON3:
-    STRING_TYPES = (str, bytes)
-    unicode = str
+STRING_TYPES = (str, bytes)
+unicode = str
+
 
-    def tobytes(i):
-        return str(i).encode("ascii")
+def tobytes(i):
+    return str(i).encode("ascii")
 
-    long = int
-else:
-    STRING_TYPES = (unicode, str)
-    tobytes = bytes
+
+long = int
 
 # Leave room for the serialization header, which includes
 # our overall length.  To make things simpler, we'll use an
@@ -87,7 +85,7 @@
 def _buf_pos(buf, pos):
     ret = buf[pos]
     # Normalize the return type to bytes
-    if compat.PYTHON3 and not isinstance(ret, bytes):
+    if not isinstance(ret, bytes):
         ret = bytes((ret,))
     return ret
 
@@ -250,10 +248,7 @@
             else:
                 raise RuntimeError("Cannot represent this mapping value")
             self.wpos += needed
-            if compat.PYTHON3:
-                iteritems = val.items()
-            else:
-                iteritems = val.iteritems()  # noqa: B301 Checked version above
+            iteritems = val.items()
             for k, v in iteritems:
                 self.append_string(k)
                 self.append_recursive(v)