changeset 48937:32ac127c999f

lsprof: remove some Python 2.7 compatibility code Differential Revision: https://phab.mercurial-scm.org/D12343
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 12:35:29 -0700
parents 680322e04f56
children f98da1349212
files mercurial/lsprof.py
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/lsprof.py	Mon Feb 21 12:34:22 2022 -0700
+++ b/mercurial/lsprof.py	Mon Feb 21 12:35:29 2022 -0700
@@ -117,9 +117,7 @@
 
 def label(code):
     if isinstance(code, str):
-        if sys.version_info.major >= 3:
-            code = code.encode('latin-1')
-        return code
+        return code.encode('latin-1')
     try:
         mname = _fn2mod[code.co_filename]
     except KeyError:
@@ -136,7 +134,4 @@
 
     res = '%s:%d(%s)' % (mname, code.co_firstlineno, code.co_name)
 
-    if sys.version_info.major >= 3:
-        res = res.encode('latin-1')
-
-    return res
+    return res.encode('latin-1')