[pypy-commit] pypy merge-2.7.2: Undo the previous change, and just add "allow_override=True".
amauryfa
noreply at buildbot.pypy.org
Sun Jan 22 17:27:09 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: merge-2.7.2
Changeset: r51646:89f238f17ecb
Date: 2012-01-22 17:25 +0100
http://bitbucket.org/pypy/pypy/changeset/89f238f17ecb/
Log: Undo the previous change, and just add "allow_override=True". This
fixes the cases when an old-style class in involved.
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -497,8 +497,8 @@
# only allow binding to a more specific class than before
if (w_cls is not None and
not space.is_w(w_cls, space.w_None) and
- not space.is_true(
- space.issubtype_allow_override(w_cls, self.w_class))):
+ not space.abstract_issubclass_w(w_cls, self.w_class,
+ allow_override=True)):
return space.wrap(self) # subclass test failed
else:
return descr_function_get(space, self.w_function, w_obj, w_cls)
diff --git a/pypy/interpreter/test/test_function.py b/pypy/interpreter/test/test_function.py
--- a/pypy/interpreter/test/test_function.py
+++ b/pypy/interpreter/test/test_function.py
@@ -597,6 +597,17 @@
# --- with an incompatible class
w_meth5 = meth3.descr_method_get(space.wrap('hello'), space.w_str)
assert space.is_w(w_meth5, w_meth3)
+ # Same thing, with an old-style class
+ w_oldclass = space.call_function(
+ space.builtin.get('__metaclass__'),
+ space.wrap('OldClass'), space.newtuple([]), space.newdict())
+ w_meth6 = meth3.descr_method_get(space.wrap('hello'), w_oldclass)
+ assert space.is_w(w_meth6, w_meth3)
+ # Reverse order of old/new styles
+ w_meth7 = descr_function_get(space, func, space.w_None, w_oldclass)
+ meth7 = space.unwrap(w_meth7)
+ w_meth8 = meth7.descr_method_get(space.wrap('hello'), space.w_str)
+ assert space.is_w(w_meth8, w_meth7)
class TestShortcuts(object):
More information about the pypy-commit
mailing list