[pypy-commit] pypy default: First fix some typos (Abtract -> Abstract), then simplify StrDictStrategy.getitem by calling the parent's method.
alex_gaynor
noreply at buildbot.pypy.org
Fri Jul 1 23:38:30 CEST 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r45253:ad23bd2e7615
Date: 2011-07-01 14:43 -0700
http://bitbucket.org/pypy/pypy/changeset/ad23bd2e7615/
Log: First fix some typos (Abtract -> Abstract), then simplify
StrDictStrategy.getitem by calling the parent's method.
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -266,7 +266,7 @@
# concrete subclasses of the above
-class AbtractTypedStrategy(object):
+class AbstractTypedStrategy(object):
_mixin_ = True
@staticmethod
@@ -364,7 +364,7 @@
w_dict.dstorage = strategy.erase(d_new)
-class ObjectDictStrategy(AbtractTypedStrategy, DictStrategy):
+class ObjectDictStrategy(AbstractTypedStrategy, DictStrategy):
erase, unerase = rerased.new_erasing_pair("object")
erase = staticmethod(erase)
@@ -390,7 +390,7 @@
def keys(self, w_dict):
return self.unerase(w_dict.dstorage).keys()
-class StringDictStrategy(AbtractTypedStrategy, DictStrategy):
+class StringDictStrategy(AbstractTypedStrategy, DictStrategy):
erase, unerase = rerased.new_erasing_pair("string")
erase = staticmethod(erase)
@@ -424,14 +424,10 @@
if type(w_key) is space.StringObjectCls:
return self.getitem_str(w_dict, w_key.unwrap(space))
# -- End of performance hack --
+ if _never_equal_to_string(space, space.type(w_key)):
+ return None
- if self.is_correct_type(w_key):
- return self.unerase(w_dict.dstorage).get(self.unwrap(w_key), None)
- elif _never_equal_to_string(space, space.type(w_key)):
- return None
- else:
- self.switch_to_object_strategy(w_dict)
- return w_dict.getitem(w_key)
+ return AbstractTypedStrategy.getitem(self, w_dict, w_key)
def getitem_str(self, w_dict, key):
assert key is not None
More information about the pypy-commit
mailing list