[pypy-commit] pypy default: Don't use deprecated raise statement syntax
rlamy
pypy.commits at gmail.com
Mon May 2 15:32:55 EDT 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch:
Changeset: r84141:a6cd96c17732
Date: 2016-05-02 20:32 +0100
http://bitbucket.org/pypy/pypy/changeset/a6cd96c17732/
Log: Don't use deprecated raise statement syntax
diff --git a/rpython/jit/backend/detect_cpu.py b/rpython/jit/backend/detect_cpu.py
--- a/rpython/jit/backend/detect_cpu.py
+++ b/rpython/jit/backend/detect_cpu.py
@@ -35,7 +35,7 @@
if not getdefined(macro, ''):
continue
return k
- raise ProcessorAutodetectError, "Cannot detect processor using compiler macros"
+ raise ProcessorAutodetectError("Cannot detect processor using compiler macros")
def detect_model_from_host_platform():
@@ -52,7 +52,7 @@
# assume we have 'uname'
mach = os.popen('uname -m', 'r').read().strip()
if not mach:
- raise ProcessorAutodetectError, "cannot run 'uname -m'"
+ raise ProcessorAutodetectError("cannot run 'uname -m'")
#
result ={'i386': MODEL_X86,
'i486': MODEL_X86,
@@ -74,7 +74,7 @@
}.get(mach)
if result is None:
- raise ProcessorAutodetectError, "unknown machine name %s" % mach
+ raise ProcessorAutodetectError("unknown machine name %s" % mach)
#
if result.startswith('x86'):
from rpython.jit.backend.x86 import detect_feature as feature
@@ -128,7 +128,7 @@
elif backend_name == MODEL_S390_64:
return "rpython.jit.backend.zarch.runner", "CPU_S390_64"
else:
- raise ProcessorAutodetectError, (
+ raise ProcessorAutodetectError(
"we have no JIT backend for this cpu: '%s'" % backend_name)
def getcpuclass(backend_name="auto"):
diff --git a/rpython/jit/backend/ppc/form.py b/rpython/jit/backend/ppc/form.py
--- a/rpython/jit/backend/ppc/form.py
+++ b/rpython/jit/backend/ppc/form.py
@@ -48,7 +48,7 @@
def __call__(self, *args, **kw):
fieldvalues, sparefields = self.calc_fields(args, kw)
if sparefields:
- raise FormException, 'fields %s left'%sparefields
+ raise FormException('fields %s left'%sparefields)
self.assembler.insts.append(Instruction(fieldvalues))
@@ -72,7 +72,7 @@
self.boundtype = boundtype
for field in specializations:
if field not in fields:
- raise FormException, field
+ raise FormException(field)
def __get__(self, ob, cls=None):
if ob is None: return self
@@ -91,14 +91,14 @@
for fname, v in more_specializatons.iteritems():
field = self.fieldmap[fname]
if field not in self.fields:
- raise FormException, "don't know about '%s' here" % field
+ raise FormException("don't know about '%s' here" % field)
if isinstance(v, str):
ds[field] = self.fieldmap[v]
else:
ms[field] = v
s.update(ms)
if len(s) != len(self.specializations) + len(ms):
- raise FormException, "respecialization not currently allowed"
+ raise FormException("respecialization not currently allowed")
if ds:
fields = list(self.fields)
for field in ds:
@@ -175,8 +175,8 @@
overlap = True
for b in range(field.left, field.right+1):
if not overlap and b in bits:
- raise FormException, "'%s' and '%s' clash at bit '%s'"%(
- bits[b], fname, b)
+ raise FormException("'%s' and '%s' clash at bit '%s'"%(
+ bits[b], fname, b))
else:
bits[b] = fname
self.fields.append(field)
@@ -186,7 +186,7 @@
for fname in specializations:
field = self.fieldmap[fname]
if field not in self.fields:
- raise FormException, "no nothin bout '%s'"%fname
+ raise FormException("no nothin bout '%s'"%fname)
s[field] = specializations[fname]
return IDesc(self.fieldmap, self.fields, s)
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2100,7 +2100,7 @@
guard_op = self.history.record(opnum, moreargs,
lltype.nullptr(llmemory.GCREF.TO))
else:
- guard_op = self.history.record(opnum, moreargs, None)
+ guard_op = self.history.record(opnum, moreargs, None)
self.capture_resumedata(resumepc)
# ^^^ records extra to history
self.staticdata.profiler.count_ops(opnum, Counters.GUARDS)
@@ -2254,7 +2254,7 @@
def execute_raised(self, exception, constant=False):
if isinstance(exception, jitexc.JitException):
- raise jitexc.JitException, exception # go through
+ raise exception # go through
llexception = jitexc.get_llexception(self.cpu, exception)
self.execute_ll_raised(llexception, constant)
diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -82,7 +82,7 @@
backendopt=False, trace_limit=sys.maxint, inline=False,
loop_longevity=0, retrace_limit=5, function_threshold=4,
disable_unrolling=sys.maxint,
- enable_opts=ALL_OPTS_NAMES, max_retrace_guards=15,
+ enable_opts=ALL_OPTS_NAMES, max_retrace_guards=15,
max_unroll_recursion=7, vec=1, vec_all=0, vec_cost=0,
vec_length=60, vec_ratio=2, vec_guard_ratio=3, **kwds):
from rpython.config.config import ConfigError
@@ -489,7 +489,7 @@
if opencoder_model == 'big':
self.metainterp_sd.opencoder_model = BigModel
else:
- self.metainterp_sd.opencoder_model = Model
+ self.metainterp_sd.opencoder_model = Model
self.stats.metainterp_sd = self.metainterp_sd
def make_virtualizable_infos(self):
@@ -934,7 +934,7 @@
raise LLException(ts.get_typeptr(value), value)
else:
value = cast_base_ptr_to_instance(Exception, value)
- raise Exception, value
+ raise value
def handle_jitexception(e):
# XXX the bulk of this function is mostly a copy-paste from above
@@ -968,7 +968,7 @@
raise LLException(ts.get_typeptr(value), value)
else:
value = cast_base_ptr_to_instance(Exception, value)
- raise Exception, value
+ raise value
jd._ll_portal_runner = ll_portal_runner # for debugging
jd.portal_runner_ptr = self.helper_func(jd._PTR_PORTAL_FUNCTYPE,
diff --git a/rpython/tool/frozenlist.py b/rpython/tool/frozenlist.py
--- a/rpython/tool/frozenlist.py
+++ b/rpython/tool/frozenlist.py
@@ -1,7 +1,7 @@
from rpython.tool.sourcetools import func_with_new_name
def forbid(*args):
- raise TypeError, "cannot mutate a frozenlist"
+ raise TypeError("cannot mutate a frozenlist")
class frozenlist(list):
__setitem__ = func_with_new_name(forbid, '__setitem__')
More information about the pypy-commit
mailing list