]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use compile() instead of eval().
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 28 Sep 2011 07:22:13 +0000 (09:22 +0200)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 28 Sep 2011 07:22:13 +0000 (09:22 +0200)
Lib/test/test_sys.py

index 9554eefcb7f62af1bc48fee2b8d63f85a7f13ac7..0b7bbf129661b65a8dfe7870d917f564e9bbe510 100644 (file)
@@ -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, "<stdin>", "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