Skip to content

Commit f2a39d7

Browse files
connieyzhuyuxuanchen1997
authored andcommitted
[llvm-lit] Resolve TypeError in built-in cat -v implementation (#98363)
Summary: When using -v in lit's internal implementation of cat, there is a TypeError when the file data is passed into convertToCaretAndMNotation() as a str, because bytearray() requires an encoded string. This patch encodes the str before passing it through bytearray(). Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250995
1 parent 933ee09 commit f2a39d7

File tree

1 file changed

+1
-1
lines changed
  • llvm/utils/lit/lit/builtin_commands

1 file changed

+1
-1
lines changed

llvm/utils/lit/lit/builtin_commands/cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
def convertToCaretAndMNotation(data):
1111
newdata = StringIO()
1212
if isinstance(data, str):
13-
data = bytearray(data)
13+
data = bytearray(data.encode())
1414

1515
for intval in data:
1616
if intval == 9 or intval == 10:

0 commit comments

Comments
 (0)