[pypy-svn] r5408 - in pypy/trunk/src/pypy/objspace: . std
arigo at codespeak.net
arigo at codespeak.net
Wed Jun 30 14:20:09 CEST 2004
Author: arigo
Date: Wed Jun 30 14:20:09 2004
New Revision: 5408
Modified:
pypy/trunk/src/pypy/objspace/std/cpythonobject.py
pypy/trunk/src/pypy/objspace/trivial.py
Log:
* Quick caching hack for cpythonobject.
* Keywords arguments missing in trivial.py.
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 Jun 30 14:20:09 2004
@@ -36,16 +36,19 @@
def __init__(w_self, space, cpyobj):
W_Object.__init__(w_self, space)
w_self.cpyobj = cpyobj
+ w_self.w_cpytype = None
def __repr__(w_self):
""" representation for debugging purposes """
return "cpyobj(%r)" % (w_self.cpyobj,)
def getclass(w_self, space):
- try:
- return space.wrap(w_self.cpyobj.__class__)
- except AttributeError: # no __class__!
- return space.wrap(type(w_self.cpyobj))
+ if w_self.w_cpytype is None:
+ try:
+ w_self.w_cpytype = space.wrap(w_self.cpyobj.__class__)
+ except AttributeError: # no __class__!
+ w_self.w_cpytype = space.wrap(type(w_self.cpyobj))
+ return w_self.w_cpytype
def lookup(w_self, name):
# hack for wrapped CPython types
Modified: pypy/trunk/src/pypy/objspace/trivial.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/trivial.py (original)
+++ pypy/trunk/src/pypy/objspace/trivial.py Wed Jun 30 14:20:09 2004
@@ -7,6 +7,7 @@
from pypy.interpreter import gateway
from pypy.interpreter.baseobjspace import *
from pypy.objspace.descroperation import DescrOperation, Object
+from pypy.interpreter.argument import Arguments
import types, sys
import __builtin__ as cpy_builtin
@@ -185,11 +186,12 @@
for descrname, descr in typedef.rawdict.items():
if isinstance(descr, interp2app):
def make_stuff(descr=descr, descrname=descrname, space=self):
- def stuff(w_obj, *args):
+ def stuff(w_obj, *args, **kwds):
fn = descr.get_function(space)
+ args = Arguments(space, list(args), kwds)
try:
- return space.call_function(space.wrap(fn),
- w_obj, *args)
+ return space.call_args(space.wrap(fn),
+ args.prepend(w_obj))
except OperationError, e:
if not hasattr(e.w_type, 'originalex'):
raise # XXX
More information about the Pypy-commit
mailing list