Author: Ronan Lamy <[email protected]>
Branch: cpyext-leakchecking
Changeset: r92024:d7afdd455feb
Date: 2017-08-02 01:55 +0100
http://bitbucket.org/pypy/pypy/changeset/d7afdd455feb/

Log:    Add option to prevent caching in space.appexec() (for cpyext tests)

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1354,7 +1354,7 @@
         return self.getitem(w_glob, self.newtext('anonymous'))
 
     @specialize.arg(2)
-    def appexec(self, posargs_w, source):
+    def appexec(self, posargs_w, source, cache=True):
         """ return value from executing given source at applevel.
             The source must look like
                '''(x, y):
@@ -1362,7 +1362,11 @@
                        return result
                '''
         """
-        w_func = self.fromcache(AppExecCache).getorbuild(source)
+        if cache:
+            w_func = self.fromcache(AppExecCache).getorbuild(source)
+        else:
+            # NB: since appdef() is not-RPython, using cache=False also is.
+            w_func = self.appdef(source)
         args = Arguments(self, list(posargs_w))
         return self.call_args(w_func, args)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to