Commits

Amaury Forgeot d'Arc committed 82ba9ff

Fix "raise TypeError", exception type vs. exception instance.

Comments (0)

Files changed (1)

pypy/interpreter/pyopcode.py

             w_cause = self.popvalue() # XXX cause?
         if 1:
             w_value = self.popvalue()
-        operror = OperationError(space.type(w_value), w_value)
+        if space.exception_is_valid_obj_as_class_w(w_value):
+            w_type = w_value
+            w_value = space.call_function(w_type)
+        else:
+            w_type = space.type(w_value)
+        operror = OperationError(w_type, w_value)
         operror.normalize_exception(space)
         w_traceback = space.w_None # XXX with_traceback?
         if not space.full_exceptions or space.is_w(w_traceback, space.w_None):