Skip to content

Commit 4e82cd7

Browse files
committed
remove to_unicode
1 parent 6252ecd commit 4e82cd7

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import lit.ShUtil as ShUtil
2222
import lit.Test as Test
2323
import lit.util
24-
from lit.util import to_bytes, to_string, to_unicode
24+
from lit.util import to_bytes, to_string
2525
from lit.BooleanExpression import BooleanExpression
2626

2727

@@ -463,7 +463,7 @@ def executeBuiltinMkdir(cmd, cmd_shenv):
463463
exitCode = 0
464464
for dir in args:
465465
dir = pathlib.Path(dir)
466-
cwd = pathlib.Path(to_unicode(cmd_shenv.cwd))
466+
cwd = pathlib.Path(cmd_shenv.cwd)
467467
if not dir.is_absolute():
468468
dir = lit.util.abs_path_preserve_drive(cwd / dir)
469469
if parent:
@@ -508,8 +508,6 @@ def on_rm_error(func, path, exc_info):
508508
exitCode = 0
509509
for path in args:
510510
cwd = cmd_shenv.cwd
511-
path = to_unicode(path) if kIsWindows else to_bytes(path)
512-
cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
513511
if not os.path.isabs(path):
514512
path = lit.util.abs_path_preserve_drive(os.path.join(cwd, path))
515513
if force and not os.path.exists(path):
@@ -703,9 +701,6 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
703701
else:
704702
# Make sure relative paths are relative to the cwd.
705703
redir_filename = os.path.join(cmd_shenv.cwd, name)
706-
redir_filename = (
707-
to_unicode(redir_filename) if kIsWindows else to_bytes(redir_filename)
708-
)
709704
fd = open(redir_filename, mode)
710705
# Workaround a Win32 and/or subprocess bug when appending.
711706
#

llvm/utils/lit/lit/util.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,6 @@ def to_string(b):
8989
raise TypeError("not sure how to convert %s to %s" % (type(b), str))
9090

9191

92-
def to_unicode(s):
93-
"""Return the parameter as type which supports unicode, possibly decoding
94-
it.
95-
96-
In Python2, this is the unicode type. In Python3 it's the str type.
97-
98-
"""
99-
if isinstance(s, bytes):
100-
# In Python2, this branch is taken for both 'str' and 'bytes'.
101-
# In Python3, this branch is taken only for 'bytes'.
102-
return s.decode("utf-8")
103-
return s
104-
105-
10692
def usable_core_count():
10793
"""Return the number of cores the current process can use, if supported.
10894
Otherwise, return the total number of cores (like `os.cpu_count()`).

0 commit comments

Comments
 (0)