Author: Manuel Jacob
Branch: remove-dict-smm
Changeset: r64104:8b5c0e47435c
Date: 2013-05-14 22:53 +0200
http://bitbucket.org/pypy/pypy/changeset/8b5c0e47435c/

Log:    Fix translation. Thanks to fijal for the workaround which explicitly
        checks whether w_other is of the right type.

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
@@ -111,6 +111,10 @@
     def descr_eq(self, space, w_other):
         if space.is_w(self, w_other):
             return space.w_True
+        if not isinstance(w_other, W_DictMultiObject):
+            raise operationerrfmt(space.w_TypeError,
+                                  "Expected dict object, got %s",
+                                  space.str_w(space.str(space.type(w_other))))
 
         if self.length() != w_other.length():
             return space.w_False
@@ -131,6 +135,11 @@
         return space.not_(self.descr_eq(space, w_other))
 
     def descr_lt(self, space, w_other):
+        if not isinstance(w_other, W_DictMultiObject):
+            raise operationerrfmt(space.w_TypeError,
+                                  "Expected dict object, got %s",
+                                  space.str_w(space.str(space.type(w_other))))
+
         # Different sizes, no problem
         if self.length() < w_other.length():
             return space.w_True
@@ -1148,7 +1157,7 @@
         w_mod    = space.getbuiltinmodule('_pickle_support')
         mod      = space.interp_w(MixedModule, w_mod)
         new_inst = mod.get('dictiter_surrogate_new')
-        w_typeobj = space.gettypeobject(dictiter_typedef)
+        w_typeobj = space.gettypeobject(W_BaseDictMultiIterObject.typedef)
 
         raise OperationError(
             space.w_TypeError,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to