Skip to content

Commit 9f60858

Browse files
committed
Use bytes.index instead of comparing each byte
1 parent 09dfb50 commit 9f60858

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Lib/_pyrepl/terminfo.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,8 @@ def _parse_terminfo_file(self, terminal_name: str) -> None:
437437
strings.append(CANCELLED_STRING)
438438
elif off < len(string_table):
439439
# Find null terminator
440-
end = off
441-
while end < len(string_table) and string_table[end] != 0:
442-
end += 1
443-
if end <= len(string_table):
440+
end = string_table.find(0, off)
441+
if end >= 0:
444442
strings.append(string_table[off:end])
445443
else:
446444
strings.append(ABSENT_STRING)

0 commit comments

Comments
 (0)