Author: Armin Rigo <[email protected]>
Branch:
Changeset: r76599:79d3671d75fe
Date: 2015-03-27 18:51 +0100
http://bitbucket.org/pypy/pypy/changeset/79d3671d75fe/
Log: merge heads
diff --git a/pypy/goal/targetpypystandalone.py
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -141,7 +141,7 @@
res = _pypy_execute_source(source)
before = rffi.aroundstate.before
if before: before()
- return rffi.cast(rffi.INT, res)
+ return rffi.cast(rffi.INT, res)
@entrypoint('main', [], c_name='pypy_init_threads')
def pypy_init_threads():
@@ -312,7 +312,7 @@
w_dict = app.getwdict(space)
entry_point, _ = create_entry_point(space, w_dict)
- return entry_point, None, PyPyAnnotatorPolicy(single_space = space)
+ return entry_point, None, PyPyAnnotatorPolicy()
def interface(self, ns):
for name in ['take_options', 'handle_config', 'print_help', 'target',
diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -33,7 +33,8 @@
PY_SSL_CLIENT, PY_SSL_SERVER = 0, 1
(PY_SSL_VERSION_SSL2, PY_SSL_VERSION_SSL3,
- PY_SSL_VERSION_SSL23, PY_SSL_VERSION_TLS1) = range(4)
+ PY_SSL_VERSION_SSL23, PY_SSL_VERSION_TLS1, PY_SSL_VERSION_TLS1_1,
+ PY_SSL_VERSION_TLS1_2) = range(6)
SOCKET_IS_NONBLOCKING, SOCKET_IS_BLOCKING = 0, 1
SOCKET_HAS_TIMED_OUT, SOCKET_HAS_BEEN_CLOSED = 2, 3
@@ -72,6 +73,9 @@
constants["PROTOCOL_SSLv3"] = PY_SSL_VERSION_SSL3
constants["PROTOCOL_SSLv23"] = PY_SSL_VERSION_SSL23
constants["PROTOCOL_TLSv1"] = PY_SSL_VERSION_TLS1
+if HAVE_TLSv1_2:
+ constants["PROTOCOL_TLSv1_1"] = PY_SSL_VERSION_TLS1_1
+ constants["PROTOCOL_TLSv1_2"] = PY_SSL_VERSION_TLS1_2
constants["OP_ALL"] = SSL_OP_ALL &~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
constants["OP_NO_SSLv2"] = SSL_OP_NO_SSLv2
@@ -140,7 +144,7 @@
def __del__(self):
rffi.free_nonmovingbuffer(
- self.protos, self.buf, self.pinned, self.is_raw)
+ self.protos, self.buf, self.pinned, self.is_raw)
@staticmethod
def advertiseNPN_cb(s, data_ptr, len_ptr, args):
@@ -162,7 +166,7 @@
client_len = len(npn.protos)
else:
client = lltype.nullptr(rffi.CCHARP.TO)
- client_len = 0
+ client_len = 0
libssl_SSL_select_next_proto(out_ptr, outlen_ptr,
server, server_len,
@@ -593,14 +597,14 @@
CB_MAXLEN = 128
with lltype.scoped_alloc(rffi.CCHARP.TO, CB_MAXLEN) as buf:
- if (libssl_SSL_session_reused(self.ssl) ^
+ if (libssl_SSL_session_reused(self.ssl) ^
(self.socket_type == PY_SSL_CLIENT)):
# if session is resumed XOR we are the client
length = libssl_SSL_get_finished(self.ssl, buf, CB_MAXLEN)
else:
# if a new session XOR we are the server
length = libssl_SSL_get_peer_finished(self.ssl, buf, CB_MAXLEN)
-
+
if length > 0:
return space.wrap(rffi.charpsize2str(buf, intmask(length)))
@@ -1107,7 +1111,7 @@
except OperationError as e:
if not e.match(space, space.w_TypeError):
raise
- raise oefmt(space.w_TypeError,
+ raise oefmt(space.w_TypeError,
"password callback must return a string")
except OperationError as e:
pw_info.operationerror = e
@@ -1196,6 +1200,10 @@
method = libssl_SSLv2_method()
elif protocol == PY_SSL_VERSION_SSL23:
method = libssl_SSLv23_method()
+ elif protocol == PY_SSL_VERSION_TLS1_1 and HAVE_TLSv1_2:
+ method = libssl_TLSv1_1_method()
+ elif protocol == PY_SSL_VERSION_TLS1_2 and HAVE_TLSv1_2:
+ method = libssl_TLSv1_2_method()
else:
raise oefmt(space.w_ValueError, "invalid protocol version")
ctx = libssl_SSL_CTX_new(method)
@@ -1348,7 +1356,7 @@
except OperationError as e:
if not e.match(space, space.w_TypeError):
raise
- raise oefmt(space.w_TypeError,
+ raise oefmt(space.w_TypeError,
"password should be a string or callable")
libssl_SSL_CTX_set_default_passwd_cb(
@@ -1452,7 +1460,7 @@
if cadata is not None:
with rffi.scoped_nonmovingbuffer(cadata) as buf:
self._add_ca_certs(space, buf, len(cadata), ca_file_type)
-
+
# load cafile or capath
if cafile is not None or capath is not None:
ret = libssl_SSL_CTX_load_verify_locations(
diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py
--- a/pypy/tool/ann_override.py
+++ b/pypy/tool/ann_override.py
@@ -13,13 +13,12 @@
class PyPyAnnotatorPolicy(AnnotatorPolicy):
- def __init__(pol, single_space=None):
- pol.lookups = {}
- pol.lookups_where = {}
- pol.pypytypes = {}
- pol.single_space = single_space
+ def __init__(self):
+ self.lookups = {}
+ self.lookups_where = {}
+ self.pypytypes = {}
- def specialize__wrap(pol, funcdesc, args_s):
+ def specialize__wrap(self, funcdesc, args_s):
from pypy.interpreter.baseobjspace import W_Root
from rpython.annotator.classdef import ClassDef
W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root)
@@ -51,102 +50,102 @@
typ = (None, str)
return funcdesc.cachedgraph(typ)
- def _remember_immutable(pol, t, cached):
+ def _remember_immutable(self, t, cached):
# for jit benefit
if cached not in t._immutable_fields_: # accessed this way just
# for convenience
t._immutable_fields_.append(cached)
- def attach_lookup(pol, t, attr):
+ def attach_lookup(self, t, attr):
cached = "cached_%s" % attr
if not t.is_heaptype() and not t.is_cpytype():
- pol._remember_immutable(t, cached)
+ self._remember_immutable(t, cached)
setattr(t, cached, t._lookup(attr))
return True
return False
- def attach_lookup_in_type_where(pol, t, attr):
+ def attach_lookup_in_type_where(self, t, attr):
cached = "cached_where_%s" % attr
if not t.is_heaptype() and not t.is_cpytype():
- pol._remember_immutable(t, cached)
+ self._remember_immutable(t, cached)
setattr(t, cached, t._lookup_where(attr))
return True
return False
- def consider_lookup(pol, bookkeeper, attr):
+ def consider_lookup(self, bookkeeper, attr):
from rpython.annotator.classdef import InstanceSource
- assert attr not in pol.lookups
+ assert attr not in self.lookups
from pypy.objspace.std import typeobject
cached = "cached_%s" % attr
clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
classdesc = clsdef.classdesc
classdesc.classdict[cached] = Constant(None)
clsdef.add_source_for_attribute(cached, classdesc)
- for t in pol.pypytypes:
- if pol.attach_lookup(t, attr):
+ for t in self.pypytypes:
+ if self.attach_lookup(t, attr):
source = InstanceSource(bookkeeper, t)
clsdef.add_source_for_attribute(cached, source)
- pol.lookups[attr] = True
+ self.lookups[attr] = True
- def consider_lookup_in_type_where(pol, bookkeeper, attr):
+ def consider_lookup_in_type_where(self, bookkeeper, attr):
from rpython.annotator.classdef import InstanceSource
- assert attr not in pol.lookups_where
+ assert attr not in self.lookups_where
from pypy.objspace.std import typeobject
cached = "cached_where_%s" % attr
clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
classdesc = clsdef.classdesc
classdesc.classdict[cached] = Constant((None, None))
clsdef.add_source_for_attribute(cached, classdesc)
- for t in pol.pypytypes:
- if pol.attach_lookup_in_type_where(t, attr):
+ for t in self.pypytypes:
+ if self.attach_lookup_in_type_where(t, attr):
source = InstanceSource(bookkeeper, t)
clsdef.add_source_for_attribute(cached, source)
- pol.lookups_where[attr] = True
+ self.lookups_where[attr] = True
- def specialize__lookup(pol, funcdesc, args_s):
+ def specialize__lookup(self, funcdesc, args_s):
s_space, s_obj, s_name = args_s
if s_name.is_constant():
attr = s_name.const
def builder(translator, func):
#print "LOOKUP", attr
- pol.consider_lookup(funcdesc.bookkeeper, attr)
+ self.consider_lookup(funcdesc.bookkeeper, attr)
d = {'__name__': '<ann_override_lookup>'}
exec CACHED_LOOKUP % {'attr': attr} in d
return translator.buildflowgraph(d['lookup_'+attr])
return funcdesc.cachedgraph(attr, builder=builder)
else:
- pol.lookups[None] = True
+ self.lookups[None] = True
return funcdesc.cachedgraph(None) # don't specialize
- def specialize__lookup_in_type_where(pol, funcdesc, args_s):
+ def specialize__lookup_in_type_where(self, funcdesc, args_s):
s_space, s_obj, s_name = args_s
if s_name.is_constant():
attr = s_name.const
def builder(translator, func):
#print "LOOKUP_IN_TYPE_WHERE", attr
- pol.consider_lookup_in_type_where(funcdesc.bookkeeper, attr)
+ self.consider_lookup_in_type_where(funcdesc.bookkeeper, attr)
d = {'__name__': '<ann_override_lookup>'}
exec CACHED_LOOKUP_IN_TYPE_WHERE % {'attr': attr} in d
return
translator.buildflowgraph(d['lookup_in_type_where_'+attr])
return funcdesc.cachedgraph(attr, builder=builder)
else:
- pol.lookups_where[None] = True
+ self.lookups_where[None] = True
return funcdesc.cachedgraph(None)
- def event(pol, bookkeeper, what, x):
+ def event(self, bookkeeper, what, x):
from pypy.objspace.std import typeobject
if isinstance(x, typeobject.W_TypeObject):
from rpython.annotator.classdef import InstanceSource
clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
- pol.pypytypes[x] = True
+ self.pypytypes[x] = True
#print "TYPE", x
- for attr in pol.lookups:
- if attr and pol.attach_lookup(x, attr):
+ for attr in self.lookups:
+ if attr and self.attach_lookup(x, attr):
cached = "cached_%s" % attr
source = InstanceSource(bookkeeper, x)
clsdef.add_source_for_attribute(cached, source)
- for attr in pol.lookups_where:
- if attr and pol.attach_lookup_in_type_where(x, attr):
+ for attr in self.lookups_where:
+ if attr and self.attach_lookup_in_type_where(x, attr):
cached = "cached_where_%s" % attr
source = InstanceSource(bookkeeper, x)
clsdef.add_source_for_attribute(cached, source)
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -12,6 +12,7 @@
from rpython.annotator import model as annmodel, signature
from rpython.annotator.argument import simple_args
from rpython.annotator.bookkeeper import Bookkeeper
+from rpython.rtyper.normalizecalls import perform_normalizations
import py
log = py.log.Producer("annrpython")
@@ -317,6 +318,8 @@
graphs[graph] = True
for graph in graphs:
simplify.eliminate_empty_blocks(graph)
+ if block_subset is None:
+ perform_normalizations(self)
#___ flowing annotations in blocks _____________________
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -42,7 +42,7 @@
def __setstate__(self, dic):
self.__dict__.update(dic) # normal action
- delayed_imports()
+ self.register_builtins()
def __init__(self, annotator):
self.annotator = annotator
@@ -67,7 +67,13 @@
self.needs_generic_instantiate = {}
self.thread_local_fields = set()
- delayed_imports()
+ self.register_builtins()
+
+ def register_builtins(self):
+ import rpython.annotator.builtin # for side-effects
+ from rpython.annotator.exception import standardexceptions
+ for cls in standardexceptions:
+ self.getuniqueclassdef(cls)
def enter(self, position_key):
"""Start of an operation.
@@ -605,6 +611,3 @@
def immutablevalue(x):
return getbookkeeper().immutablevalue(x)
-
-def delayed_imports():
- import rpython.annotator.builtin
diff --git a/rpython/annotator/exception.py b/rpython/annotator/exception.py
new file mode 100644
--- /dev/null
+++ b/rpython/annotator/exception.py
@@ -0,0 +1,7 @@
+from rpython.rlib import rstackovf
+
+# the exceptions that can be implicitely raised by some operations
+standardexceptions = set([TypeError, OverflowError, ValueError,
+ ZeroDivisionError, MemoryError, IOError, OSError, StopIteration, KeyError,
+ IndexError, AssertionError, RuntimeError, UnicodeDecodeError,
+ UnicodeEncodeError, NotImplementedError, rstackovf._StackOverflow])
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -255,6 +255,8 @@
OPENSSL_VERSION_NUMBER != 0x00909000
if OPENSSL_VERSION_NUMBER < 0x0090800f and not OPENSSL_NO_ECDH:
OPENSSL_NO_ECDH = True
+HAVE_TLSv1_2 = OPENSSL_VERSION_NUMBER >= 0x10001000
+
def external(name, argtypes, restype, **kw):
kw['compilation_info'] = eci
@@ -284,6 +286,9 @@
ssl_external('SSL_get_SSL_CTX', [SSL], SSL_CTX)
ssl_external('SSL_set_SSL_CTX', [SSL, SSL_CTX], SSL_CTX)
ssl_external('TLSv1_method', [], SSL_METHOD)
+if HAVE_TLSv1_2:
+ ssl_external('TLSv1_1_method', [], SSL_METHOD)
+ ssl_external('TLSv1_2_method', [], SSL_METHOD)
ssl_external('SSLv2_method', [], SSL_METHOD)
ssl_external('SSLv3_method', [], SSL_METHOD)
ssl_external('SSLv23_method', [], SSL_METHOD)
diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py
--- a/rpython/rtyper/annlowlevel.py
+++ b/rpython/rtyper/annlowlevel.py
@@ -41,9 +41,10 @@
__repr__ = __str__
class LowLevelAnnotatorPolicy(AnnotatorPolicy):
- def __init__(pol, rtyper=None):
- pol.rtyper = rtyper
+ def __init__(self, rtyper=None):
+ self.rtyper = rtyper
+ @staticmethod
def lowlevelspecialize(funcdesc, args_s, key_for_args):
args_s, key1, builder = flatten_star_args(funcdesc, args_s)
key = []
@@ -73,21 +74,20 @@
flowgraph = funcdesc.cachedgraph(key, builder=builder)
args_s[:] = new_args_s
return flowgraph
- lowlevelspecialize = staticmethod(lowlevelspecialize)
+ @staticmethod
def default_specialize(funcdesc, args_s):
return LowLevelAnnotatorPolicy.lowlevelspecialize(funcdesc, args_s, {})
- default_specialize = staticmethod(default_specialize)
specialize__ll = default_specialize
+ @staticmethod
def specialize__ll_and_arg(funcdesc, args_s, *argindices):
keys = {}
for i in argindices:
keys[i] = args_s[i].const
return LowLevelAnnotatorPolicy.lowlevelspecialize(funcdesc, args_s,
keys)
- specialize__ll_and_arg = staticmethod(specialize__ll_and_arg)
def annotate_lowlevel_helper(annotator, ll_function, args_s, policy=None):
if policy is None:
@@ -99,24 +99,23 @@
class MixLevelAnnotatorPolicy(LowLevelAnnotatorPolicy):
- def __init__(pol, annhelper):
- pol.annhelper = annhelper
- pol.rtyper = annhelper.rtyper
+ def __init__(self, annhelper):
+ self.rtyper = annhelper.rtyper
- def default_specialize(pol, funcdesc, args_s):
+ def default_specialize(self, funcdesc, args_s):
name = funcdesc.name
if name.startswith('ll_') or name.startswith('_ll_'): # xxx can we do
better?
- return super(MixLevelAnnotatorPolicy, pol).default_specialize(
+ return super(MixLevelAnnotatorPolicy, self).default_specialize(
funcdesc, args_s)
else:
return AnnotatorPolicy.default_specialize(funcdesc, args_s)
- def specialize__arglltype(pol, funcdesc, args_s, i):
- key = pol.rtyper.getrepr(args_s[i]).lowleveltype
+ def specialize__arglltype(self, funcdesc, args_s, i):
+ key = self.rtyper.getrepr(args_s[i]).lowleveltype
alt_name = funcdesc.name+"__for_%sLlT" % key._short_name()
return funcdesc.cachedgraph(key, alt_name=valid_identifier(alt_name))
- def specialize__genconst(pol, funcdesc, args_s, i):
+ def specialize__genconst(self, funcdesc, args_s, i):
# XXX this is specific to the JIT
TYPE = annotation_to_lltype(args_s[i], 'genconst')
args_s[i] = lltype_to_annotation(TYPE)
diff --git a/rpython/rtyper/exceptiondata.py b/rpython/rtyper/exceptiondata.py
--- a/rpython/rtyper/exceptiondata.py
+++ b/rpython/rtyper/exceptiondata.py
@@ -1,15 +1,9 @@
from rpython.annotator import model as annmodel
+from rpython.annotator.exception import standardexceptions
from rpython.rtyper.llannotation import SomePtr
-from rpython.rlib import rstackovf
from rpython.rtyper.rclass import (
ll_issubclass, ll_type, ll_cast_to_object, getclassrepr, getinstancerepr)
-# the exceptions that can be implicitely raised by some operations
-standardexceptions = set([TypeError, OverflowError, ValueError,
- ZeroDivisionError, MemoryError, IOError, OSError, StopIteration, KeyError,
- IndexError, AssertionError, RuntimeError, UnicodeDecodeError,
- UnicodeEncodeError, NotImplementedError, rstackovf._StackOverflow])
-
class UnknownException(Exception):
pass
@@ -20,7 +14,6 @@
standardexceptions = standardexceptions
def __init__(self, rtyper):
- self.make_standard_exceptions(rtyper)
# (NB. rclass identifies 'Exception' and 'object')
r_type = rtyper.rootclass_repr
r_instance = getinstancerepr(rtyper, None)
@@ -32,11 +25,6 @@
self.lltype_of_exception_value = r_instance.lowleveltype
self.rtyper = rtyper
- def make_standard_exceptions(self, rtyper):
- bk = rtyper.annotator.bookkeeper
- for cls in self.standardexceptions:
- bk.getuniqueclassdef(cls)
-
def finish(self, rtyper):
bk = rtyper.annotator.bookkeeper
for cls in self.standardexceptions:
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -26,7 +26,6 @@
attachRuntimeTypeInfo, Primitive)
from rpython.rtyper.rmodel import Repr, inputconst, BrokenReprTyperError
from rpython.rtyper.typesystem import LowLevelTypeSystem, getfunctionptr
-from rpython.rtyper.normalizecalls import perform_normalizations
from rpython.rtyper import rclass
from rpython.rtyper.rclass import RootClassRepr
from rpython.tool.pairtype import pair
@@ -55,8 +54,6 @@
self.concrete_calltables = {}
self.cache_dummy_values = {}
self.lltype2vtable = {}
- self.typererrors = []
- self.typererror_count = 0
# make the primitive_to_repr constant mapping
self.primitive_to_repr = {}
self.isinstance_helpers = {}
@@ -169,22 +166,16 @@
def specialize(self, dont_simplify_again=False):
"""Main entry point: specialize all annotated blocks of the program."""
# specialize depends on annotator simplifications
- assert dont_simplify_again in (False, True) # safety check
if not dont_simplify_again:
self.annotator.simplify()
-
- # first make sure that all functions called in a group have exactly
- # the same signature, by hacking their flow graphs if needed
- perform_normalizations(self.annotator)
self.exceptiondata.finish(self)
# new blocks can be created as a result of specialize_block(), so
# we need to be careful about the loop here.
self.already_seen = {}
self.specialize_more_blocks()
- if self.exceptiondata is not None:
- self.exceptiondata.make_helpers(self)
- self.specialize_more_blocks() # for the helpers just made
+ self.exceptiondata.make_helpers(self)
+ self.specialize_more_blocks() # for the helpers just made
def getannmixlevel(self):
if self.annmixlevel is not None:
@@ -231,18 +222,11 @@
percentage = 100 * n // total
if percentage >= previous_percentage + 5:
previous_percentage = percentage
- if self.typererror_count:
- error_report = " but %d errors" %
self.typererror_count
- else:
- error_report = ''
- self.log.event('specializing: %d / %d blocks
(%d%%)%s' %
- (n, total, percentage, error_report))
+ self.log.event('specializing: %d / %d blocks (%d%%)'
%
+ (n, total, percentage))
# make sure all reprs so far have had their setup() called
self.call_all_setups()
- if self.typererrors:
- self.dump_typererrors(to_log=True)
- raise TyperError("there were %d error" % len(self.typererrors))
self.log.event('-=- specialized %d%s blocks -=-' % (
blockcount, newtext))
annmixlevel = self.annmixlevel
@@ -250,29 +234,6 @@
if annmixlevel is not None:
annmixlevel.finish()
- def dump_typererrors(self, num=None, minimize=True, to_log=False):
- c = 0
- bc = 0
- for err in self.typererrors[:num]:
- c += 1
- if minimize and isinstance(err, BrokenReprTyperError):
- bc += 1
- continue
- graph, block, position = err.where
- errmsg = ("TyperError-%d: %s\n" % (c, graph) +
- str(err) +
- "\n")
- if to_log:
- self.log.ERROR(errmsg)
- else:
- print errmsg
- if bc:
- minmsg = "(minimized %d errors away for this dump)" % (bc,)
- if to_log:
- self.log.ERROR(minmsg)
- else:
- print minmsg
-
def call_all_setups(self):
# make sure all reprs so far have had their setup() called
must_setup_more = []
@@ -324,9 +285,9 @@
# give the best possible types to the input args
try:
self.setup_block_entry(block)
- except TyperError, e:
- self.gottypererror(e, block, "block-entry", None)
- return # cannot continue this block
+ except TyperError as e:
+ self.gottypererror(e, block, "block-entry")
+ raise
# specialize all the operations, as far as possible
@@ -341,9 +302,9 @@
try:
hop.setup() # this is called from here to catch TyperErrors...
self.translate_hl_to_ll(hop, varmapping)
- except TyperError, e:
- self.gottypererror(e, block, hop.spaceop, newops)
- return # cannot continue this block: no op.result.concretetype
+ except TyperError as e:
+ self.gottypererror(e, block, hop.spaceop)
+ raise
block.operations[:] = newops
block.renamevariables(varmapping)
@@ -432,9 +393,9 @@
continue # no conversion needed
try:
new_a1 = newops.convertvar(a1, r_a1, r_a2)
- except TyperError, e:
- self.gottypererror(e, block, link, newops)
- continue # try other args
+ except TyperError as e:
+ self.gottypererror(e, block, link)
+ raise
if new_a1 != a1:
newlinkargs[i] = new_a1
@@ -516,14 +477,10 @@
"has no return value" % op.opname)
op.result.concretetype = Void
- def gottypererror(self, e, block, position, llops):
- """Record a TyperError without crashing immediately.
- Put a 'TyperError' operation in the graph instead.
- """
+ def gottypererror(self, exc, block, position):
+ """Record information about the location of a TyperError"""
graph = self.annotator.annotated.get(block)
- e.where = (graph, block, position)
- self.typererror_count += 1
- raise
+ exc.where = (graph, block, position)
# __________ regular operations __________
diff --git a/rpython/rtyper/test/test_llinterp.py
b/rpython/rtyper/test/test_llinterp.py
--- a/rpython/rtyper/test/test_llinterp.py
+++ b/rpython/rtyper/test/test_llinterp.py
@@ -25,22 +25,12 @@
py.log._setstate(mod.logstate)
-
-def timelog(prefix, call, *args, **kwds):
- #import time
- #print prefix, "...",
- #start = time.time()
- res = call(*args, **kwds)
- #elapsed = time.time() - start
- #print "%.2f secs" % (elapsed,)
- return res
-
def gengraph(func, argtypes=[], viewbefore='auto', policy=None,
backendopt=False, config=None, **extraconfigopts):
t = TranslationContext(config=config)
t.config.set(**extraconfigopts)
a = t.buildannotator(policy=policy)
- timelog("annotating", a.build_types, func, argtypes, main_entry_point=True)
+ a.build_types(func, argtypes, main_entry_point=True)
a.validate()
if viewbefore == 'auto':
viewbefore = getattr(option, 'view', False)
@@ -49,13 +39,13 @@
t.view()
global typer # we need it for find_exception
typer = t.buildrtyper()
- timelog("rtyper-specializing", typer.specialize)
+ typer.specialize()
#t.view()
- timelog("checking graphs", t.checkgraphs)
+ t.checkgraphs()
if backendopt:
from rpython.translator.backendopt.all import backend_optimizations
backend_optimizations(t)
- timelog("checking graphs", t.checkgraphs)
+ t.checkgraphs()
if viewbefore:
t.view()
desc = t.annotator.bookkeeper.getdesc(func)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit