[pypy-commit] pypy py3.3: prefer use of __mro__ instead of recursing the inheritance hierarchy
numerodix
noreply at buildbot.pypy.org
Sat Aug 2 00:39:59 CEST 2014
Author: Martin Matusiak <numerodix at gmail.com>
Branch: py3.3
Changeset: r72642:239d45aea639
Date: 2014-07-29 20:58 +0200
http://bitbucket.org/pypy/pypy/changeset/239d45aea639/
Log: prefer use of __mro__ instead of recursing the inheritance hierarchy
diff --git a/pypy/objspace/std/objecttype.py b/pypy/objspace/std/objecttype.py
--- a/pypy/objspace/std/objecttype.py
+++ b/pypy/objspace/std/objecttype.py
@@ -27,16 +27,14 @@
Dict.update(klass.__dict__)
except AttributeError: pass
try:
- # XXX - Use of .__mro__ would be suggested, if the existance
- # of that attribute could be guarranted.
- bases = klass.__bases__
+ bases = klass.__mro__
except AttributeError: pass
else:
try:
#Note that since we are only interested in the keys,
# the order we merge classes is unimportant
for base in bases:
- Dict.update(_classdir(base))
+ Dict.update(base.__dict__)
except TypeError: pass
return Dict
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -738,16 +738,14 @@
Dict.update(klass.__dict__)
except AttributeError: pass
try:
- # XXX - Use of .__mro__ would be suggested, if the existance
- # of that attribute could be guarranted.
- bases = klass.__bases__
+ bases = klass.__mro__
except AttributeError: pass
else:
try:
#Note that since we are only interested in the keys,
# the order we merge classes is unimportant
for base in bases:
- Dict.update(_classdir(base))
+ Dict.update(base.__dict__)
except TypeError: pass
return Dict
More information about the pypy-commit
mailing list