[pypy-commit] pypy pypy-in-a-box: rage on python closures
fijal
noreply at buildbot.pypy.org
Wed Jul 18 15:05:54 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: pypy-in-a-box
Changeset: r56144:38ebdf95b92c
Date: 2012-07-18 15:05 +0200
http://bitbucket.org/pypy/pypy/changeset/38ebdf95b92c/
Log: rage on python closures
diff --git a/pypy/objspace/std/embedding.py b/pypy/objspace/std/embedding.py
--- a/pypy/objspace/std/embedding.py
+++ b/pypy/objspace/std/embedding.py
@@ -62,10 +62,14 @@
return lltype.nullptr(rffi.VOIDP)
return res
+def _newfunc(space, name, func):
+ def newfunc(*args):
+ return func(space, *args)
+ newfunc.func_name = 'pypy_' + name
+ return newfunc
+
def initialize(space):
for name, (func, argtypes, restype) in FUNCTIONS.iteritems():
- def newfunc(*args):
- return func(space, *args)
- newfunc.func_name = 'pypy_' + name
+ newfunc = _newfunc(space, name, func)
deco = entrypoint("embedding", argtypes, 'pypy_' + name, relax=True)
deco(newfunc)
More information about the pypy-commit
mailing list