Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r60879:2c31a396f622
Date: 2013-02-04 22:29 +0100
http://bitbucket.org/pypy/pypy/changeset/2c31a396f622/

Log:    Add an error message on translating locals() which points people to
        the right direction, after a discussion on #pypy where people
        complained about doing something more automatically.

diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
--- a/rpython/flowspace/specialcase.py
+++ b/rpython/flowspace/specialcase.py
@@ -65,8 +65,18 @@
 def sc_we_are_translated(space, we_are_translated, args):
     return Constant(True)
 
+def sc_locals(space, locals, args):
+    raise Exception(
+        "A function calling locals() is not RPython.  "
+        "Note that if you're translating code outside the PyPy "
+        "repository, a likely cause is that py.test's --assert=rewrite "
+        "mode is getting in the way.  You should copy the file "
+        "pytest.ini from the root of the PyPy repository into your "
+        "own project.")
+
 SPECIAL_CASES = {__import__: sc_import, r_uint: sc_r_uint,
-        we_are_translated: sc_we_are_translated}
+        we_are_translated: sc_we_are_translated,
+        locals: sc_locals}
 for fn in OperationName:
     SPECIAL_CASES[fn] = sc_operator
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to