Commit 5d501019 authored by Jeroen Demeyer's avatar Jeroen Demeyer

Only error out for non-ASCII literals on actual bytes literals

parent 775fb036
......@@ -960,7 +960,7 @@ def p_string_literal(s, kind_override=None):
bytes_value, unicode_value = chars.getstrings()
if is_python3_source and has_non_ascii_literal_characters:
# Python 3 forbids literal non-ASCII characters in byte strings
if kind not in ('u', 'f'):
if kind == 'b':
s.error("bytes can only contain ASCII literal characters.", pos=pos)
bytes_value = None
if kind == 'f':
......
......@@ -57,6 +57,8 @@ def no_unicode_literals():
>>> print( no_unicode_literals() )
True
abcdefg
Testing non-ASCII docstrings: Πυθαγόρας
"""
print(isinstance(str_string, str) or type(str_string))
return str_string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment