diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index a906f665661..010870fa986 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -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': diff --git a/tests/run/cython3_no_unicode_literals.pyx b/tests/run/cython3_no_unicode_literals.pyx index c347fe613db..ba6143931ab 100644 --- a/tests/run/cython3_no_unicode_literals.pyx +++ b/tests/run/cython3_no_unicode_literals.pyx @@ -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