[pypy-svn] r10754 - pypy/dist/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Sat Apr 16 23:02:01 CEST 2005


Author: arigo
Date: Sat Apr 16 23:02:01 2005
New Revision: 10754

Modified:
   pypy/dist/pypy/tool/pytestsupport.py
Log:
It wasn't quite right still to use eval().  raises() should accept any
statement(s).

On our daily "did you know?" Python list, here is one: if you compile any
possibly large source with compile(_, _, 'exec'), then you get a code object
that eval() is just fine to execute.  (It just returns None.)



Modified: pypy/dist/pypy/tool/pytestsupport.py
==============================================================================
--- pypy/dist/pypy/tool/pytestsupport.py	(original)
+++ pypy/dist/pypy/tool/pytestsupport.py	Sat Apr 16 23:02:01 2005
@@ -155,10 +155,7 @@
         for key, w_value in kwds_w.items():
             space.setitem(w_locals, space.wrap(key), w_value)
         try:
-            space.call_function(space.builtin.get('eval'),
-                                space.wrap(str(source)),
-                                frame.w_globals,
-                                w_locals)
+            space.exec_(str(source), frame.w_globals, w_locals)
         except OperationError, e:
             if e.match(space, w_ExpectedException):
                 return space.sys.call('exc_info')



More information about the Pypy-commit mailing list