[pypy-commit] pypy default: Be a bit more narrative about what can create a closure

krono noreply at buildbot.pypy.org
Sat Mar 29 12:48:52 CET 2014


Author: Tobias Pape <tobias at netshed.de>
Branch: 
Changeset: r70325:33a9aeb0b05e
Date: 2014-03-29 12:47 +0100
http://bitbucket.org/pypy/pypy/changeset/33a9aeb0b05e/

Log:	Be a bit more narrative about what can create a closure

diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -16,7 +16,13 @@
     if func.func_doc and func.func_doc.lstrip().startswith('NOT_RPYTHON'):
         raise ValueError("%r is tagged as NOT_RPYTHON" % (func,))
     if func.func_code.co_cellvars:
-        raise ValueError("RPython functions cannot create closures")
+        raise ValueError(
+"""RPython functions cannot create closures
+Possible casues:
+    Function is inner function
+    Function uses generator expressions
+    Lambda expressions
+""")
     if not (func.func_code.co_flags & CO_NEWLOCALS):
         raise ValueError("The code object for a RPython function should have "
                          "the flag CO_NEWLOCALS set.")


More information about the pypy-commit mailing list