diff --git a/mypyc/codegen/cstring.py b/mypyc/codegen/cstring.py index 853787f8161d4..0220d5b0c24a4 100644 --- a/mypyc/codegen/cstring.py +++ b/mypyc/codegen/cstring.py @@ -31,7 +31,8 @@ # These assignments must come last because we prioritize simple escape # sequences over any other representation. -for c in ("'", '"', "\\", "a", "b", "f", "n", "r", "t", "v"): +for c in ("'", '"', "\\", "a", "b", "f", "n", "r", "t", "v", "0"): + escaped = f"\\{c}" decoded = escaped.encode("ascii").decode("unicode_escape") CHAR_MAP[ord(decoded)] = escaped