py3: fix a crecord encoding issue

Summary: This only happens if specified context shows up.

Reviewed By: ytsheng

Differential Revision: D23460476

fbshipit-source-id: 788e236bd8e28918afa6b1e0a4e1be297b6f5a66
This commit is contained in:
Jun Wu 2020-09-01 21:09:53 -07:00 committed by Facebook GitHub Bot
parent 211739f00c
commit c84653c7a9

View File

@ -989,7 +989,9 @@ class curseschunkselector(object):
# strip \n, and convert control characters to ^[char] representation
text = text.strip(b"\n")
text = re.sub(
br"[\x00-\x08\x0a-\x1f]", lambda m: b"^" + chr(ord(m.group()) + 64), text
br"[\x00-\x08\x0a-\x1f]",
lambda m: b"^" + bytearray([ord(m.group()) + 64]),
text,
)
if pair is not None: