summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-09-28 07:15:11 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-09-28 07:15:11 (GMT)
commit0c9fe4d109a94d1a923991d223ab60fbce8420f5 (patch)
treeba48b800447eeffb46f89abcabb5bda602e8fa10 /Lib/test/test_sys.py
parent418170c50e46e239103018c7059aa75c6108677a (diff)
downloadcpython-0c9fe4d109a94d1a923991d223ab60fbce8420f5.zip
cpython-0c9fe4d109a94d1a923991d223ab60fbce8420f5.tar.gz
cpython-0c9fe4d109a94d1a923991d223ab60fbce8420f5.tar.bz2
Use eval instead of codecs.lookup to trigger UTF-8 generation.
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index ed96d76..9554eef 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -857,12 +857,10 @@ class SizeofTest(unittest.TestCase):
s = chr(0x4000) # 4 bytes canonical representation
check(s, size(compactfields) + 4)
try:
- # FIXME: codecs.lookup(str) calls encoding.search_function() which
- # calls __import__ using str in the module name. __import__ encodes
- # the module name to the file system encoding (which is the locale
- # encoding), so test_sys fails if the locale encoding is not UTF-8.
- codecs.lookup(s) # produces 4 bytes UTF-8
- except LookupError:
+ # eval() will trigger the generation of the UTF-8 representation
+ # as a side effect
+ eval(s)
+ except NameError:
check(s, size(compactfields) + 4 + 4)
# TODO: add check that forces the presence of wchar_t representation
# TODO: add check that forces layout of unicodefields