[pypy-svn] rev 2417 - pypy/trunk/src/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Wed Dec 17 11:52:09 CET 2003
Author: arigo
Date: Wed Dec 17 11:52:08 2003
New Revision: 2417
Modified:
pypy/trunk/src/pypy/objspace/std/cpythonobject.py
Log:
Binary operations work with a CPythonObject at the right.
Modified: pypy/trunk/src/pypy/objspace/std/cpythonobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/cpythonobject.py (original)
+++ pypy/trunk/src/pypy/objspace/std/cpythonobject.py Wed Dec 17 11:52:08 2003
@@ -206,6 +206,18 @@
multimethod = getattr(StdObjSpace, _name)
multimethod.register(cpython_f, *arglist)
+ if len(multimethod.specialnames) > 1 and _arity == 2:
+ def cpython_f_rev(space, w_1, w_2, f=f):
+ # XXX do we really want to unwrap unknown objects here?
+ x1 = space.unwrap(w_1)
+ x2 = w_2.cpyobj
+ try:
+ y = f(x1, x2)
+ except:
+ wrap_exception(space)
+ return space.wrap(y)
+ multimethod.register(cpython_f_rev, W_ANY, W_CPythonObject)
+
def is_true__CPython(space, w_obj):
obj = space.unwrap(w_obj)
More information about the Pypy-commit
mailing list