[pypy-commit] pypy oefmt: oefmt pypy/interpreter/
pjenvey
pypy.commits at gmail.com
Mon May 2 01:12:45 EDT 2016
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: oefmt
Changeset: r84117:77443b718701
Date: 2016-05-01 22:08 -0700
http://bitbucket.org/pypy/pypy/changeset/77443b718701/
Log: oefmt pypy/interpreter/
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -354,9 +354,7 @@
key = space.str_w(w_key)
except OperationError, e:
if e.match(space, space.w_TypeError):
- raise OperationError(
- space.w_TypeError,
- space.wrap("keywords must be strings"))
+ raise oefmt(space.w_TypeError, "keywords must be strings")
if e.match(space, space.w_UnicodeEncodeError):
# Allow this to pass through
key = None
diff --git a/pypy/interpreter/astcompiler/ast.py b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -16,8 +16,8 @@
def check_string(space, w_obj):
if not (space.isinstance_w(w_obj, space.w_str) or
space.isinstance_w(w_obj, space.w_unicode)):
- raise OperationError(space.w_TypeError, space.wrap(
- 'AST string must be of type str or unicode'))
+ raise oefmt(space.w_TypeError,
+ "AST string must be of type str or unicode")
return w_obj
def get_field(space, w_node, name, optional):
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -399,8 +399,8 @@
def check_string(space, w_obj):
if not (space.isinstance_w(w_obj, space.w_str) or
space.isinstance_w(w_obj, space.w_unicode)):
- raise OperationError(space.w_TypeError, space.wrap(
- 'AST string must be of type str or unicode'))
+ raise oefmt(space.w_TypeError,
+ "AST string must be of type str or unicode")
return w_obj
def get_field(space, w_node, name, optional):
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -67,8 +67,8 @@
return space.gettypeobject(self.typedef)
def setclass(self, space, w_subtype):
- raise OperationError(space.w_TypeError,
- space.wrap("__class__ assignment: only for heap types"))
+ raise oefmt(space.w_TypeError,
+ "__class__ assignment: only for heap types")
def user_setup(self, space, w_subtype):
raise NotImplementedError("only for interp-level user subclasses "
@@ -706,8 +706,7 @@
try:
return rthread.allocate_lock()
except rthread.error:
- raise OperationError(self.w_RuntimeError,
- self.wrap("out of resources"))
+ raise oefmt(self.w_RuntimeError, "out of resources")
# Following is a friendly interface to common object space operations
# that can be defined in term of more primitive ones. Subclasses
@@ -901,8 +900,7 @@
raise
break # done
if idx == expected_length:
- raise OperationError(self.w_ValueError,
- self.wrap("too many values to unpack"))
+ raise oefmt(self.w_ValueError, "too many values to unpack")
items[idx] = w_item
idx += 1
if idx < expected_length:
@@ -962,8 +960,8 @@
hint = self.int_w(w_hint)
if hint < 0:
- raise OperationError(self.w_ValueError, self.wrap(
- "__length_hint__() should return >= 0"))
+ raise oefmt(self.w_ValueError,
+ "__length_hint__() should return >= 0")
return hint
def fixedview(self, w_iterable, expected_length=-1):
@@ -1330,8 +1328,7 @@
if start < 0:
start += seqlength
if not (0 <= start < seqlength):
- raise OperationError(self.w_IndexError,
- self.wrap("index out of range"))
+ raise oefmt(self.w_IndexError, "index out of range")
stop = 0
step = 0
return start, stop, step
@@ -1351,8 +1348,7 @@
if start < 0:
start += seqlength
if not (0 <= start < seqlength):
- raise OperationError(self.w_IndexError,
- self.wrap("index out of range"))
+ raise oefmt(self.w_IndexError, "index out of range")
stop = 0
step = 0
length = 1
@@ -1396,20 +1392,17 @@
try:
return bigint.tolonglong()
except OverflowError:
- raise OperationError(self.w_OverflowError,
- self.wrap('integer too large'))
+ raise oefmt(self.w_OverflowError, "integer too large")
def r_ulonglong_w(self, w_obj, allow_conversion=True):
bigint = self.bigint_w(w_obj, allow_conversion)
try:
return bigint.toulonglong()
except OverflowError:
- raise OperationError(self.w_OverflowError,
- self.wrap('integer too large'))
+ raise oefmt(self.w_OverflowError, "integer too large")
except ValueError:
- raise OperationError(self.w_ValueError,
- self.wrap('cannot convert negative integer '
- 'to unsigned int'))
+ raise oefmt(self.w_ValueError,
+ "cannot convert negative integer to unsigned int")
BUF_SIMPLE = 0x0000
BUF_WRITABLE = 0x0001
@@ -1555,8 +1548,8 @@
from rpython.rlib import rstring
result = w_obj.str_w(self)
if '\x00' in result:
- raise OperationError(self.w_TypeError, self.wrap(
- 'argument must be a string without NUL characters'))
+ raise oefmt(self.w_TypeError,
+ "argument must be a string without NUL characters")
return rstring.assert_str0(result)
def int_w(self, w_obj, allow_conversion=True):
@@ -1596,8 +1589,7 @@
def realstr_w(self, w_obj):
# Like str_w, but only works if w_obj is really of type 'str'.
if not self.isinstance_w(w_obj, self.w_str):
- raise OperationError(self.w_TypeError,
- self.wrap('argument must be a string'))
+ raise oefmt(self.w_TypeError, "argument must be a string")
return self.str_w(w_obj)
def unicode_w(self, w_obj):
@@ -1608,16 +1600,16 @@
from rpython.rlib import rstring
result = w_obj.unicode_w(self)
if u'\x00' in result:
- raise OperationError(self.w_TypeError, self.wrap(
- 'argument must be a unicode string without NUL characters'))
+ raise oefmt(self.w_TypeError,
+ "argument must be a unicode string without NUL "
+ "characters")
return rstring.assert_str0(result)
def realunicode_w(self, w_obj):
# Like unicode_w, but only works if w_obj is really of type
# 'unicode'.
if not self.isinstance_w(w_obj, self.w_unicode):
- raise OperationError(self.w_TypeError,
- self.wrap('argument must be a unicode'))
+ raise oefmt(self.w_TypeError, "argument must be a unicode")
return self.unicode_w(w_obj)
def bool_w(self, w_obj):
@@ -1636,8 +1628,8 @@
def gateway_r_uint_w(self, w_obj):
if self.isinstance_w(w_obj, self.w_float):
- raise OperationError(self.w_TypeError,
- self.wrap("integer argument expected, got float"))
+ raise oefmt(self.w_TypeError,
+ "integer argument expected, got float")
return self.uint_w(self.int(w_obj))
def gateway_nonnegint_w(self, w_obj):
@@ -1645,8 +1637,7 @@
# the integer is negative. Here for gateway.py.
value = self.gateway_int_w(w_obj)
if value < 0:
- raise OperationError(self.w_ValueError,
- self.wrap("expected a non-negative integer"))
+ raise oefmt(self.w_ValueError, "expected a non-negative integer")
return value
def c_int_w(self, w_obj):
@@ -1654,8 +1645,7 @@
# the integer does not fit in 32 bits. Here for gateway.py.
value = self.gateway_int_w(w_obj)
if value < INT_MIN or value > INT_MAX:
- raise OperationError(self.w_OverflowError,
- self.wrap("expected a 32-bit integer"))
+ raise oefmt(self.w_OverflowError, "expected a 32-bit integer")
return value
def c_uint_w(self, w_obj):
@@ -1663,8 +1653,8 @@
# the integer does not fit in 32 bits. Here for gateway.py.
value = self.uint_w(w_obj)
if value > UINT_MAX:
- raise OperationError(self.w_OverflowError,
- self.wrap("expected an unsigned 32-bit integer"))
+ raise oefmt(self.w_OverflowError,
+ "expected an unsigned 32-bit integer")
return value
def c_nonnegint_w(self, w_obj):
@@ -1673,11 +1663,9 @@
# for gateway.py.
value = self.int_w(w_obj)
if value < 0:
- raise OperationError(self.w_ValueError,
- self.wrap("expected a non-negative integer"))
+ raise oefmt(self.w_ValueError, "expected a non-negative integer")
if value > INT_MAX:
- raise OperationError(self.w_OverflowError,
- self.wrap("expected a 32-bit integer"))
+ raise oefmt(self.w_OverflowError, "expected a 32-bit integer")
return value
def c_short_w(self, w_obj):
@@ -1733,17 +1721,15 @@
w_fileno = self.getattr(w_fd, self.wrap("fileno"))
except OperationError, e:
if e.match(self, self.w_AttributeError):
- raise OperationError(self.w_TypeError,
- self.wrap("argument must be an int, or have a fileno() "
- "method.")
- )
+ raise oefmt(self.w_TypeError,
+ "argument must be an int, or have a fileno() "
+ "method.")
raise
w_fd = self.call_function(w_fileno)
if (not self.isinstance_w(w_fd, self.w_int) and
not self.isinstance_w(w_fd, self.w_long)):
- raise OperationError(self.w_TypeError,
- self.wrap("fileno() returned a non-integer")
- )
+ raise oefmt(self.w_TypeError,
+ "fileno() returned a non-integer")
try:
fd = self.c_int_w(w_fd)
except OperationError, e:
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -214,9 +214,8 @@
w_inst = w_type
w_instclass = self._exception_getclass(space, w_inst)
if not space.is_w(w_value, space.w_None):
- raise OperationError(space.w_TypeError,
- space.wrap("instance exception may not "
- "have a separate value"))
+ raise oefmt(space.w_TypeError,
+ "instance exception may not have a separate value")
w_value = w_inst
w_type = w_instclass
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -202,16 +202,15 @@
def setdict(self, space, w_dict):
if not space.isinstance_w(w_dict, space.w_dict):
- raise OperationError(space.w_TypeError,
- space.wrap("setting function's dictionary to a non-dict")
- )
+ raise oefmt(space.w_TypeError,
+ "setting function's dictionary to a non-dict")
self.w_func_dict = w_dict
def descr_function__new__(space, w_subtype, w_code, w_globals,
w_name=None, w_argdefs=None, w_closure=None):
code = space.interp_w(Code, w_code)
if not space.isinstance_w(w_globals, space.w_dict):
- raise OperationError(space.w_TypeError, space.wrap("expected dict"))
+ raise oefmt(space.w_TypeError, "expected dict")
if not space.is_none(w_name):
name = space.str_w(w_name)
else:
@@ -227,15 +226,15 @@
if space.is_none(w_closure) and nfreevars == 0:
closure = None
elif not space.is_w(space.type(w_closure), space.w_tuple):
- raise OperationError(space.w_TypeError, space.wrap("invalid closure"))
+ raise oefmt(space.w_TypeError, "invalid closure")
else:
from pypy.interpreter.nestedscope import Cell
closure_w = space.unpackiterable(w_closure)
n = len(closure_w)
if nfreevars == 0:
- raise OperationError(space.w_ValueError, space.wrap("no closure needed"))
+ raise oefmt(space.w_ValueError, "no closure needed")
elif nfreevars != n:
- raise OperationError(space.w_ValueError, space.wrap("closure is wrong size"))
+ raise oefmt(space.w_ValueError, "closure is wrong size")
closure = [space.interp_w(Cell, w_cell) for w_cell in closure_w]
func = space.allocate_instance(Function, w_subtype)
Function.__init__(func, space, code, w_globals, defs_w, closure, name)
@@ -321,8 +320,8 @@
w_func_dict, w_module) = args_w
except ValueError:
# wrong args
- raise OperationError(space.w_ValueError,
- space.wrap("Wrong arguments to function.__setstate__"))
+ raise oefmt(space.w_ValueError,
+ "Wrong arguments to function.__setstate__")
self.space = space
self.name = space.str_w(w_name)
@@ -359,7 +358,8 @@
self.defs_w = []
return
if not space.isinstance_w(w_defaults, space.w_tuple):
- raise OperationError(space.w_TypeError, space.wrap("func_defaults must be set to a tuple object or None"))
+ raise oefmt(space.w_TypeError,
+ "func_defaults must be set to a tuple object or None")
self.defs_w = space.fixedview(w_defaults)
def fdel_func_defaults(self, space):
@@ -380,8 +380,8 @@
if space.isinstance_w(w_name, space.w_str):
self.name = space.str_w(w_name)
else:
- raise OperationError(space.w_TypeError,
- space.wrap("__name__ must be set to a string object"))
+ raise oefmt(space.w_TypeError,
+ "__name__ must be set to a string object")
def fdel_func_doc(self, space):
self.w_doc = space.w_None
@@ -406,8 +406,8 @@
def fset_func_code(self, space, w_code):
from pypy.interpreter.pycode import PyCode
if not self.can_change_code:
- raise OperationError(space.w_TypeError,
- space.wrap("Cannot change code attribute of builtin functions"))
+ raise oefmt(space.w_TypeError,
+ "Cannot change code attribute of builtin functions")
code = space.interp_w(Code, w_code)
closure_len = 0
if self.closure:
@@ -457,8 +457,7 @@
if space.is_w(w_instance, space.w_None):
w_instance = None
if w_instance is None and space.is_none(w_class):
- raise OperationError(space.w_TypeError,
- space.wrap("unbound methods must have class"))
+ raise oefmt(space.w_TypeError, "unbound methods must have class")
method = space.allocate_instance(Method, w_subtype)
Method.__init__(method, space, w_function, w_instance, w_class)
return space.wrap(method)
@@ -659,8 +658,8 @@
self.w_module = func.w_module
def descr_builtinfunction__new__(space, w_subtype):
- raise OperationError(space.w_TypeError,
- space.wrap("cannot create 'builtin_function' instances"))
+ raise oefmt(space.w_TypeError,
+ "cannot create 'builtin_function' instances")
def descr_function_repr(self):
return self.space.wrap('<built-in function %s>' % (self.name,))
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -21,7 +21,7 @@
from pypy.interpreter.signature import Signature
from pypy.interpreter.baseobjspace import (W_Root, ObjSpace, SpaceCache,
DescrMismatch)
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.function import ClassMethod, FunctionWithFixedCode
from rpython.rlib import rstackovf
from rpython.rlib.objectmodel import we_are_translated
@@ -699,14 +699,13 @@
raise
raise e
except KeyboardInterrupt:
- raise OperationError(space.w_KeyboardInterrupt,
- space.w_None)
+ raise OperationError(space.w_KeyboardInterrupt, space.w_None)
except MemoryError:
raise OperationError(space.w_MemoryError, space.w_None)
except rstackovf.StackOverflow, e:
rstackovf.check_stack_overflow()
- raise OperationError(space.w_RuntimeError,
- space.wrap("maximum recursion depth exceeded"))
+ raise oefmt(space.w_RuntimeError,
+ "maximum recursion depth exceeded")
except RuntimeError: # not on top of py.py
raise OperationError(space.w_RuntimeError, space.w_None)
@@ -762,8 +761,7 @@
try:
w_result = self.fastfunc_0(space)
except DescrMismatch:
- raise OperationError(space.w_SystemError,
- space.wrap("unexpected DescrMismatch error"))
+ raise oefmt(space.w_SystemError, "unexpected DescrMismatch error")
except Exception, e:
self.handle_exception(space, e)
w_result = None
diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -1,5 +1,5 @@
from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.pyopcode import LoopBlock
from rpython.rlib import jit
@@ -76,8 +76,7 @@
def _send_ex(self, w_arg, operr):
space = self.space
if self.running:
- raise OperationError(space.w_ValueError,
- space.wrap('generator already executing'))
+ raise oefmt(space.w_ValueError, "generator already executing")
frame = self.frame
if frame is None:
# xxx a bit ad-hoc, but we don't want to go inside
@@ -89,8 +88,9 @@
last_instr = jit.promote(frame.last_instr)
if last_instr == -1:
if w_arg and not space.is_w(w_arg, space.w_None):
- msg = "can't send non-None value to a just-started generator"
- raise OperationError(space.w_TypeError, space.wrap(msg))
+ raise oefmt(space.w_TypeError,
+ "can't send non-None value to a just-started "
+ "generator")
else:
if not w_arg:
w_arg = space.w_None
@@ -151,8 +151,8 @@
raise
if w_retval is not None:
- msg = "generator ignored GeneratorExit"
- raise OperationError(space.w_RuntimeError, space.wrap(msg))
+ raise oefmt(space.w_RuntimeError,
+ "generator ignored GeneratorExit")
def descr_gi_frame(self, space):
if self.frame is not None and not self.frame.frame_finished_execution:
@@ -184,8 +184,7 @@
# XXX copied and simplified version of send_ex()
space = self.space
if self.running:
- raise OperationError(space.w_ValueError,
- space.wrap('generator already executing'))
+ raise oefmt(space.w_ValueError, "generator already executing")
frame = self.frame
if frame is None: # already finished
return
diff --git a/pypy/interpreter/nestedscope.py b/pypy/interpreter/nestedscope.py
--- a/pypy/interpreter/nestedscope.py
+++ b/pypy/interpreter/nestedscope.py
@@ -1,7 +1,7 @@
from rpython.tool.uid import uid
from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import oefmt
from pypy.interpreter.mixedmodule import MixedModule
@@ -78,4 +78,4 @@
try:
return self.get()
except ValueError:
- raise OperationError(space.w_ValueError, space.wrap("Cell is empty"))
+ raise oefmt(space.w_ValueError, "Cell is empty")
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -8,7 +8,7 @@
from pypy.interpreter import eval
from pypy.interpreter.signature import Signature
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.astcompiler.consts import (
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS, CO_NESTED,
@@ -374,14 +374,13 @@
lnotab, w_freevars=None, w_cellvars=None,
magic=default_magic):
if argcount < 0:
- raise OperationError(space.w_ValueError,
- space.wrap("code: argcount must not be negative"))
+ raise oefmt(space.w_ValueError,
+ "code: argcount must not be negative")
if nlocals < 0:
- raise OperationError(space.w_ValueError,
- space.wrap("code: nlocals must not be negative"))
+ raise oefmt(space.w_ValueError,
+ "code: nlocals must not be negative")
if not space.isinstance_w(w_constants, space.w_tuple):
- raise OperationError(space.w_TypeError,
- space.wrap("Expected tuple for constants"))
+ raise oefmt(space.w_TypeError, "Expected tuple for constants")
consts_w = space.fixedview(w_constants)
names = unpack_str_tuple(space, w_names)
varnames = unpack_str_tuple(space, w_varnames)
diff --git a/pypy/interpreter/pycompiler.py b/pypy/interpreter/pycompiler.py
--- a/pypy/interpreter/pycompiler.py
+++ b/pypy/interpreter/pycompiler.py
@@ -7,7 +7,7 @@
from pypy.interpreter.pyparser import future, pyparse, error as parseerror
from pypy.interpreter.astcompiler import (astbuilder, codegen, consts, misc,
optimize, ast)
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
class AbstractCompiler(object):
@@ -116,8 +116,7 @@
else:
check = True
if not check:
- raise OperationError(self.space.w_TypeError, self.space.wrap(
- "invalid node type"))
+ raise oefmt(self.space.w_TypeError, "invalid node type")
fut = misc.parse_future(node, self.future_flags.compiler_features)
f_flags, f_lineno, f_col = fut
@@ -132,8 +131,7 @@
mod = optimize.optimize_ast(space, node, info)
code = codegen.compile_ast(space, mod, info)
except parseerror.SyntaxError, e:
- raise OperationError(space.w_SyntaxError,
- e.wrap_info(space))
+ raise OperationError(space.w_SyntaxError, e.wrap_info(space))
return code
def compile_to_ast(self, source, filename, mode, flags):
@@ -146,11 +144,9 @@
parse_tree = self.parser.parse_source(source, info)
mod = astbuilder.ast_from_node(space, parse_tree, info)
except parseerror.IndentationError, e:
- raise OperationError(space.w_IndentationError,
- e.wrap_info(space))
+ raise OperationError(space.w_IndentationError, e.wrap_info(space))
except parseerror.SyntaxError, e:
- raise OperationError(space.w_SyntaxError,
- e.wrap_info(space))
+ raise OperationError(space.w_SyntaxError, e.wrap_info(space))
return mod
def compile(self, source, filename, mode, flags, hidden_applevel=False):
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -220,9 +220,9 @@
return # no cells needed - fast path
elif outer_func is None:
space = self.space
- raise OperationError(space.w_TypeError,
- space.wrap("directly executed code object "
- "may not contain free variables"))
+ raise oefmt(space.w_TypeError,
+ "directly executed code object may not contain free "
+ "variables")
if outer_func and outer_func.closure:
closure_size = len(outer_func.closure)
else:
@@ -513,7 +513,7 @@
self.locals_cells_stack_w = values_w[:]
valuestackdepth = space.int_w(w_stackdepth)
if not self._check_stack_index(valuestackdepth):
- raise OperationError(space.w_ValueError, space.wrap("invalid stackdepth"))
+ raise oefmt(space.w_ValueError, "invalid stackdepth")
assert valuestackdepth >= 0
self.valuestackdepth = valuestackdepth
if space.is_w(w_exc_value, space.w_None):
@@ -686,12 +686,11 @@
try:
new_lineno = space.int_w(w_new_lineno)
except OperationError:
- raise OperationError(space.w_ValueError,
- space.wrap("lineno must be an integer"))
+ raise oefmt(space.w_ValueError, "lineno must be an integer")
if self.get_w_f_trace() is None:
- raise OperationError(space.w_ValueError,
- space.wrap("f_lineno can only be set by a trace function."))
+ raise oefmt(space.w_ValueError,
+ "f_lineno can only be set by a trace function.")
line = self.pycode.co_firstlineno
if new_lineno < line:
@@ -718,8 +717,8 @@
# Don't jump to a line with an except in it.
code = self.pycode.co_code
if ord(code[new_lasti]) in (DUP_TOP, POP_TOP):
- raise OperationError(space.w_ValueError,
- space.wrap("can't jump to 'except' line as there's no exception"))
+ raise oefmt(space.w_ValueError,
+ "can't jump to 'except' line as there's no exception")
# Don't jump into or out of a finally block.
f_lasti_setup_addr = -1
@@ -800,8 +799,8 @@
new_iblock = f_iblock - delta_iblock
if new_iblock > min_iblock:
- raise OperationError(space.w_ValueError,
- space.wrap("can't jump into the middle of a block"))
+ raise oefmt(space.w_ValueError,
+ "can't jump into the middle of a block")
while f_iblock > new_iblock:
block = self.pop_block()
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -253,8 +253,7 @@
def unknown_objclass_getter(space):
# NB. this is an AttributeError to make inspect.py happy
- raise OperationError(space.w_AttributeError,
- space.wrap("generic property has no __objclass__"))
+ raise oefmt(space.w_AttributeError, "generic property has no __objclass__")
@specialize.arg(0)
def make_objclass_getter(tag, func, cls):
@@ -328,8 +327,7 @@
Change the value of the property of the given obj."""
fset = self.fset
if fset is None:
- raise OperationError(space.w_TypeError,
- space.wrap("readonly attribute"))
+ raise oefmt(space.w_TypeError, "readonly attribute")
try:
fset(self, space, w_obj, w_value)
except DescrMismatch:
@@ -344,8 +342,7 @@
Delete the value of the property from the given obj."""
fdel = self.fdel
if fdel is None:
- raise OperationError(space.w_AttributeError,
- space.wrap("cannot delete attribute"))
+ raise oefmt(space.w_AttributeError, "cannot delete attribute")
try:
fdel(self, space, w_obj)
except DescrMismatch:
More information about the pypy-commit
mailing list