[pypy-commit] pypy py3k: exec can no longer modify the local scope, so use an explicit scope instead

antocuni noreply at buildbot.pypy.org
Fri Jan 27 20:29:19 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r51875:ba117ac345c3
Date: 2012-01-27 12:32 +0100
http://bitbucket.org/pypy/pypy/changeset/ba117ac345c3/

Log:	exec can no longer modify the local scope, so use an explicit scope
	instead

diff --git a/pypy/interpreter/test/test_syntax.py b/pypy/interpreter/test/test_syntax.py
--- a/pypy/interpreter/test/test_syntax.py
+++ b/pypy/interpreter/test/test_syntax.py
@@ -164,8 +164,9 @@
     def test_condexpr(self):
         for s, expected in [("x = 1 if True else 2", 1),
                             ("x = 1 if False else 2", 2)]:
-            exec(s)
-            assert x == expected
+            ns = {}
+            exec(s, ns)
+            assert ns['x'] == expected
 
     def test_condexpr_no_warning(self):
         import warnings


More information about the pypy-commit mailing list