Commit 4189b42b authored by Stefan Behnel's avatar Stefan Behnel

add regression test for non-optimised unicode.encode() calls

parent 15c349ec
...@@ -20,6 +20,15 @@ def default(): ...@@ -20,6 +20,15 @@ def default():
""" """
return u'abcdefg'.encode() return u'abcdefg'.encode()
def encode_non_constant(encoding):
"""
>>> isinstance(encode_non_constant('utf8'), _bytes)
True
>>> encode_non_constant('utf8') == u.encode('UTF-8')
True
"""
return text.encode(encoding)
@cython.test_assert_path_exists('//PythonCapiFunctionNode[@cname = "PyUnicode_AsUTF8String"]') @cython.test_assert_path_exists('//PythonCapiFunctionNode[@cname = "PyUnicode_AsUTF8String"]')
def utf8(): def utf8():
""" """
......
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