summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hansen <markhansen@google.com>2021-09-19 23:57:30 +0000
committerMark Hansen <markhansen@google.com>2021-09-19 23:57:37 +0000
commit844f6bdebb04261c5a66e92beb12e2cc95eb0197 (patch)
tree53b9867fa24a43951d7cbafcc59fc8256f172b5c
parentc57a063a79ee6279bccbf6889f2d85caa6309cd9 (diff)
downloadextras-844f6bdebb04261c5a66e92beb12e2cc95eb0197.tar.gz
Drop some python2 support in simpleperf_utils.py
From the changelog, looks like python2 support has been dropped in simpleperf. Change-Id: I3094015f76f5d2031cb5a1f868579145a11ce7f6
-rw-r--r--simpleperf/scripts/simpleperf_utils.py8
1 files changed, 0 insertions, 8 deletions
diff --git a/simpleperf/scripts/simpleperf_utils.py b/simpleperf/scripts/simpleperf_utils.py
index 648ddd1b..a82abec5 100644
--- a/simpleperf/scripts/simpleperf_utils.py
+++ b/simpleperf/scripts/simpleperf_utils.py
@@ -56,13 +56,7 @@ def get_platform() -> str:
return 'linux'
-def is_python3() -> str:
- return sys.version_info >= (3, 0)
-
-
def str_to_bytes(str_value: str) -> bytes:
- if not is_python3():
- return str_value
# In python 3, str are wide strings whereas the C api expects 8 bit strings,
# hence we have to convert. For now using utf-8 as the encoding.
return str_value.encode('utf-8')
@@ -71,8 +65,6 @@ def str_to_bytes(str_value: str) -> bytes:
def bytes_to_str(bytes_value: Optional[bytes]) -> str:
if not bytes_value:
return ''
- if not is_python3():
- return bytes_value
return bytes_value.decode('utf-8')