Author: Carl Friedrich Bolz <[email protected]>
Branch: dict-strategies
Changeset: r44497:61dae755c3b6
Date: 2011-05-26 13:46 +0200
http://bitbucket.org/pypy/pypy/changeset/61dae755c3b6/
Log: even better name: _never_equal_to_string
diff --git a/pypy/objspace/std/celldict.py b/pypy/objspace/std/celldict.py
--- a/pypy/objspace/std/celldict.py
+++ b/pypy/objspace/std/celldict.py
@@ -4,7 +4,7 @@
speed up global lookups a lot."""
from pypy.objspace.std.dictmultiobject import IteratorImplementation
-from pypy.objspace.std.dictmultiobject import DictStrategy,
_hashes_differently_than_string
+from pypy.objspace.std.dictmultiobject import DictStrategy,
_never_equal_to_string
from pypy.objspace.std.dictmultiobject import ObjectDictStrategy
from pypy.rlib import jit, rerased
@@ -79,7 +79,7 @@
# maps to the same cell later (even if this cell no longer
# represents a key)
cell.invalidate()
- elif _hashes_differently_than_string(space, w_key_type):
+ elif _never_equal_to_string(space, w_key_type):
raise KeyError
else:
self.switch_to_object_strategy(w_dict)
@@ -99,7 +99,7 @@
if space.is_w(w_lookup_type, space.w_str):
return self.getitem_str(w_dict, space.str_w(w_lookup))
- elif _hashes_differently_than_string(space, w_lookup_type):
+ elif _never_equal_to_string(space, w_lookup_type):
return None
else:
self.switch_to_object_strategy(w_dict)
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
@@ -13,7 +13,7 @@
def _is_str(space, w_key):
return space.is_w(space.type(w_key), space.w_str)
-def _hashes_differently_than_string(space, w_lookup_type):
+def _never_equal_to_string(space, w_lookup_type):
""" Handles the case of a non string key lookup.
Types that have a sane hash/eq function should allow us to return True
directly to signal that the key is not in the dict in any case.
@@ -421,7 +421,7 @@
if self.is_correct_type(w_key):
return self.unerase(w_dict.dstorage).get(self.unwrap(w_key), None)
- elif _hashes_differently_than_string(space, space.type(w_key)):
+ elif _never_equal_to_string(space, space.type(w_key)):
return None
else:
self.switch_to_object_strategy(w_dict)
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -6,7 +6,7 @@
from pypy.interpreter.baseobjspace import W_Root
from pypy.objspace.std.dictmultiobject import W_DictMultiObject, DictStrategy,
ObjectDictStrategy
from pypy.objspace.std.dictmultiobject import IteratorImplementation
-from pypy.objspace.std.dictmultiobject import _hashes_differently_than_string
+from pypy.objspace.std.dictmultiobject import _never_equal_to_string
from pypy.objspace.std.objectobject import W_ObjectObject
from pypy.objspace.std.typeobject import TypeCell
@@ -600,7 +600,7 @@
w_lookup_type = space.type(w_lookup)
if space.is_w(w_lookup_type, space.w_str):
return self.getitem_str(w_dict, space.str_w(w_lookup))
- elif _hashes_differently_than_string(space, w_lookup_type):
+ elif _never_equal_to_string(space, w_lookup_type):
return None
else:
self.switch_to_object_strategy(w_dict)
@@ -644,7 +644,7 @@
flag = w_obj.deldictvalue(space, w_key)
if not flag:
raise KeyError
- elif _hashes_differently_than_string(space, w_key_type):
+ elif _never_equal_to_string(space, w_key_type):
raise KeyError
else:
self.switch_to_object_strategy(w_dict)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit