[pypy-commit] pypy default: generalize numpy appbridge to pass through any arguments
bdkearns
noreply at buildbot.pypy.org
Mon Oct 28 22:07:53 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r67656:21aee1bf4f2a
Date: 2013-10-28 13:25 -0400
http://bitbucket.org/pypy/pypy/changeset/21aee1bf4f2a/
Log: generalize numpy appbridge to pass through any arguments
diff --git a/pypy/module/micronumpy/appbridge.py b/pypy/module/micronumpy/appbridge.py
--- a/pypy/module/micronumpy/appbridge.py
+++ b/pypy/module/micronumpy/appbridge.py
@@ -1,4 +1,3 @@
-
from rpython.rlib.objectmodel import specialize
class AppBridgeCache(object):
@@ -16,16 +15,16 @@
return sys.modules['numpypy.core._methods']
return f
""")
-
+
@specialize.arg(2)
- def call_method(self, space, name, *args):
+ def call_method(self, space, name, w_obj, args):
w_meth = getattr(self, 'w_' + name)
if w_meth is None:
if self.w_module is None:
self.w_module = space.call_function(self.w_import)
w_meth = space.getattr(self.w_module, space.wrap(name))
setattr(self, 'w_' + name, w_meth)
- return space.call_function(w_meth, *args)
+ return space.call_args(w_meth, args.prepend(w_obj))
def set_string_function(space, w_f, w_repr):
cache = get_appbridge_cache(space)
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -827,15 +827,11 @@
return loop.multidim_dot(space, self, other, w_res, dtype,
other_critical_dim)
- @unwrap_spec(w_axis = WrappedDefault(None))
- def descr_var(self, space, w_axis):
- return get_appbridge_cache(space).call_method(space, '_var', self,
- w_axis)
+ def descr_var(self, space, __args__):
+ return get_appbridge_cache(space).call_method(space, '_var', self, __args__)
- @unwrap_spec(w_axis = WrappedDefault(None))
- def descr_std(self, space, w_axis):
- return get_appbridge_cache(space).call_method(space, '_std', self,
- w_axis)
+ def descr_std(self, space, __args__):
+ return get_appbridge_cache(space).call_method(space, '_std', self, __args__)
# ----------------------- reduce -------------------------------
More information about the pypy-commit
mailing list