libsyntax: Forbid escapes in the inclusive range \x80-\xff in
Unicode characters and strings. Use `\u0080`-`\u00ff` instead. ASCII/byte literals are unaffected. This PR introduces a new function, `escape_default`, into the ASCII module. This was necessary for the pretty printer to continue to function. RFC #326. Closes #18062. [breaking-change]
This commit is contained in:
@@ -283,7 +283,7 @@ def load_east_asian_width(want_widths, except_cats):
|
||||
return widths
|
||||
|
||||
def escape_char(c):
|
||||
if c <= 0xff:
|
||||
if c <= 0x7f:
|
||||
return "'\\x%2.2x'" % c
|
||||
if c <= 0xffff:
|
||||
return "'\\u%4.4x'" % c
|
||||
|
||||
Reference in New Issue
Block a user