From: Martin v. Löwis Date: Wed, 28 Sep 2011 07:22:13 +0000 (+0200) Subject: Use compile() instead of eval(). X-Git-Tag: v3.3.0a1~1484 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f02aa65acb7b1b66ac7898680e5a6817c380f7eb;p=thirdparty%2FPython%2Fcpython.git Use compile() instead of eval(). --- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 9554eefcb7f6..0b7bbf129661 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -856,12 +856,10 @@ class SizeofTest(unittest.TestCase): # verify that the UTF-8 size is accounted for s = chr(0x4000) # 4 bytes canonical representation check(s, size(compactfields) + 4) - try: - # eval() will trigger the generation of the UTF-8 representation - # as a side effect - eval(s) - except NameError: - check(s, size(compactfields) + 4 + 4) + # compile() will trigger the generation of the UTF-8 + # representation as a side effect + compile(s, "", "eval") + 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 # weakref