Commit f9388e15 authored by Stefan Behnel's avatar Stefan Behnel Committed by GitHub

Merge pull request #2645 from jdemeyer/bytes_non_ascii

Only error out for non-ASCII literals on actual bytes literals
parents eb841ce5 5d501019
......@@ -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