Commit 2804d357 authored by Martin v. Löwis's avatar Martin v. Löwis

Use eval instead of codecs.lookup to trigger UTF-8 generation.

parent 0e71acc5
...@@ -857,12 +857,10 @@ class SizeofTest(unittest.TestCase): ...@@ -857,12 +857,10 @@ class SizeofTest(unittest.TestCase):
s = chr(0x4000) # 4 bytes canonical representation s = chr(0x4000) # 4 bytes canonical representation
check(s, size(compactfields) + 4) check(s, size(compactfields) + 4)
try: try:
# FIXME: codecs.lookup(str) calls encoding.search_function() which # eval() will trigger the generation of the UTF-8 representation
# calls __import__ using str in the module name. __import__ encodes # as a side effect
# the module name to the file system encoding (which is the locale eval(s)
# encoding), so test_sys fails if the locale encoding is not UTF-8. except NameError:
codecs.lookup(s) # produces 4 bytes UTF-8
except LookupError:
check(s, size(compactfields) + 4 + 4) check(s, size(compactfields) + 4 + 4)
# TODO: add check that forces the presence of wchar_t representation # TODO: add check that forces the presence of wchar_t representation
# TODO: add check that forces layout of unicodefields # TODO: add check that forces layout of unicodefields
......
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