[pypy-svn] r4868 - pypy/branch/src-newobjectmodel/pypy/interpreter
hpk at codespeak.net
hpk at codespeak.net
Thu Jun 3 15:51:28 CEST 2004
Author: hpk
Date: Thu Jun 3 15:51:27 2004
New Revision: 4868
Modified:
pypy/branch/src-newobjectmodel/pypy/interpreter/function.py
pypy/branch/src-newobjectmodel/pypy/interpreter/typedef.py
Log:
- fixed bugs
- added func_defaults
Modified: pypy/branch/src-newobjectmodel/pypy/interpreter/function.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/interpreter/function.py (original)
+++ pypy/branch/src-newobjectmodel/pypy/interpreter/function.py Thu Jun 3 15:51:27 2004
@@ -170,8 +170,13 @@
space = self.space
return self.call(space.newtuple(args_w),
space.newdict([(space.wrap(key), w_item)
- for key, w_item in kwds_w]))
+ for key, w_item in kwds_w.items()]))
+ def fget_func_defaults(space, self):
+ values_w = self.defs_w
+ if values_w is None:
+ return space.w_None
+ return space.newtuple(values_w)
class Method(Wrappable):
"""A method is a function bound to a specific instance or class."""
@@ -205,4 +210,4 @@
space = self.space
return self.call(space.newtuple(args_w),
space.newdict([(space.wrap(key), w_item)
- for key, w_item in kwds_w]))
+ for key, w_item in kwds_w.items()]))
Modified: pypy/branch/src-newobjectmodel/pypy/interpreter/typedef.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/interpreter/typedef.py (original)
+++ pypy/branch/src-newobjectmodel/pypy/interpreter/typedef.py Thu Jun 3 15:51:27 2004
@@ -15,6 +15,9 @@
class GetSetProperty(Wrappable):
def __init__(self, fget, fset=None, fdel=None, doc=None):
+ fget = getattr(fget, 'im_func', fget)
+ fset = getattr(fset, 'im_func', fset)
+ fdel = getattr(fdel, 'im_func', fdel)
self.fget = fget
self.fset = fset
self.fdel = fdel
@@ -100,6 +103,7 @@
func_doc = attrproperty('doc'),
func_name = attrproperty('name'),
func_dict = attrproperty_w('w_func_dict'),
+ func_defaults = GetSetProperty(Function.fget_func_defaults),
__doc__ = attrproperty('doc'),
__name__ = attrproperty('name'),
__dict__ = attrproperty_w('w_func_dict'),
More information about the Pypy-commit
mailing list