[pypy-commit] pypy guard-compatible: fix test_dictmultiobject.py
cfbolz
pypy.commits at gmail.com
Mon Aug 8 12:48:12 EDT 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: guard-compatible
Changeset: r86083:f1fe34175fc1
Date: 2016-08-05 18:28 +0200
http://bitbucket.org/pypy/pypy/changeset/f1fe34175fc1/
Log: fix test_dictmultiobject.py
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
@@ -592,16 +592,15 @@
return self.erase(None)
def switch_to_correct_strategy(self, w_dict, w_key):
- from pypy.objspace.std.intobject import W_IntObject
if type(w_key) is self.space.StringObjectCls:
self.switch_to_bytes_strategy(w_dict)
return
elif type(w_key) is self.space.UnicodeObjectCls:
self.switch_to_unicode_strategy(w_dict)
return
- elif type(w_key) is W_IntObject:
+ elif type(w_key) is self.space.IntObjectCls:
self.switch_to_int_strategy(w_dict)
- if self.space.compares_by_identity(w_key):
+ elif self.space.compares_by_identity(w_key):
self.switch_to_identity_strategy(w_dict)
else:
self.switch_to_object_strategy(w_dict)
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -49,6 +49,7 @@
self.FrameClass = frame.build_frame(self)
self.StringObjectCls = W_BytesObject
self.UnicodeObjectCls = W_UnicodeObject
+ self.IntObjectCls = W_IntObject
# singletons
self.w_None = W_NoneObject.w_None
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1108,11 +1108,15 @@
w_float = float
StringObjectCls = FakeString
UnicodeObjectCls = FakeUnicode
+ IntObjectCls = int
w_dict = W_DictObject
iter = iter
fixedview = list
listview = list
+ def compares_by_identity(self, w_obj):
+ return False # safe default
+
class Config:
class objspace:
class std:
More information about the pypy-commit
mailing list