[pypy-commit] pypy remove-remaining-smm: Revert some uses of oefmt where the message is not a constant string.
Manuel Jacob
noreply at buildbot.pypy.org
Mon Feb 24 21:56:01 CET 2014
Author: Manuel Jacob
Branch: remove-remaining-smm
Changeset: r69361:dcdb95496ffb
Date: 2014-02-24 21:14 +0100
http://bitbucket.org/pypy/pypy/changeset/dcdb95496ffb/
Log: Revert some uses of oefmt where the message is not a constant
string.
diff --git a/pypy/objspace/std/complexobject.py b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -410,7 +410,7 @@
try:
return space.newfloat(math.hypot(self.realval, self.imagval))
except OverflowError, e:
- raise oefmt(space.w_OverflowError, str(e))
+ raise OperationError(space.w_OverflowError, space.wrap(str(e)))
def descr_eq(self, space, w_other):
if isinstance(w_other, W_ComplexObject):
@@ -487,7 +487,7 @@
try:
return self.div(w_rhs)
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_rtruediv(self, space, w_lhs):
w_lhs = self._to_complex(space, w_lhs)
@@ -496,7 +496,7 @@
try:
return w_lhs.div(self)
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_floordiv(self, space, w_rhs):
w_rhs = self._to_complex(space, w_rhs)
@@ -506,7 +506,7 @@
try:
return self.divmod(space, w_rhs)[0]
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_rfloordiv(self, space, w_lhs):
w_lhs = self._to_complex(space, w_lhs)
@@ -516,7 +516,7 @@
try:
return w_lhs.divmod(space, self)[0]
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_mod(self, space, w_rhs):
w_rhs = self._to_complex(space, w_rhs)
@@ -525,7 +525,7 @@
try:
return self.divmod(space, w_rhs)[1]
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_rmod(self, space, w_lhs):
w_lhs = self._to_complex(space, w_lhs)
@@ -534,7 +534,7 @@
try:
return w_lhs.divmod(space, self)[1]
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
def descr_divmod(self, space, w_rhs):
w_rhs = self._to_complex(space, w_rhs)
@@ -543,7 +543,7 @@
try:
div, mod = self.divmod(space, w_rhs)
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
return space.newtuple([div, mod])
def descr_rdivmod(self, space, w_lhs):
@@ -553,7 +553,7 @@
try:
div, mod = w_lhs.divmod(space, self)
except ZeroDivisionError, e:
- raise oefmt(space.w_ZeroDivisionError, str(e))
+ raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e)))
return space.newtuple([div, mod])
@unwrap_spec(w_third_arg=WrappedDefault(None))
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -1,6 +1,6 @@
from pypy.interpreter import gateway
from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.error import oefmt
+from pypy.interpreter.error import oefmt, OperationError
from pypy.interpreter.function import Function, StaticMethod
from pypy.interpreter.typedef import weakref_descr, GetSetProperty,\
descr_get_dict
@@ -684,7 +684,7 @@
def _check(space, w_type, msg="descriptor is for 'type'"):
if not isinstance(w_type, W_TypeObject):
- raise oefmt(space.w_TypeError, msg)
+ raise OperationError(space.w_TypeError, space.wrap(msg))
return w_type
More information about the pypy-commit
mailing list