[pypy-commit] pypy kill-someobject: fix test_descriptor
fijal
noreply at buildbot.pypy.org
Thu Oct 11 09:40:41 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-someobject
Changeset: r58006:5ef114da6d50
Date: 2012-10-11 09:40 +0200
http://bitbucket.org/pypy/pypy/changeset/5ef114da6d50/
Log: fix test_descriptor
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -424,12 +424,13 @@
w_res = space.w_None
return w_res
+
def descr_function_get(space, w_function, w_obj, w_cls=None):
"""functionobject.__get__(obj[, type]) -> method"""
# this is not defined as a method on Function because it's generally
# useful logic: w_function can be any callable. It is used by Method too.
asking_for_bound = (space.is_none(w_cls) or
- not space.is_none(w_obj) or
+ not space.is_w(w_obj, space.w_None) or
space.is_w(w_cls, space.type(space.w_None)))
if asking_for_bound:
return space.wrap(Method(space, w_function, w_obj, w_cls))
@@ -613,7 +614,7 @@
self.w_function = w_function
def descr_classmethod_get(self, space, w_obj, w_klass=None):
- if space.is_w(w_klass, space.w_None):
+ if space.is_none(w_klass):
w_klass = space.type(w_obj)
return space.wrap(Method(space, self.w_function, w_klass, space.w_None))
diff --git a/pypy/module/__builtin__/descriptor.py b/pypy/module/__builtin__/descriptor.py
--- a/pypy/module/__builtin__/descriptor.py
+++ b/pypy/module/__builtin__/descriptor.py
@@ -50,6 +50,7 @@
def descr_new_super(space, w_subtype, w_starttype, w_obj_or_type=None):
if space.is_none(w_obj_or_type):
w_type = None # unbound super object
+ w_obj_or_type = space.w_None
else:
w_objtype = space.type(w_obj_or_type)
if space.is_true(space.issubtype(w_objtype, space.w_type)) and \
More information about the pypy-commit
mailing list