Author: Ronan Lamy <ronan.l...@gmail.com> Branch: Changeset: r71753:36c1c430d065 Date: 2014-05-28 16:46 +0100 http://bitbucket.org/pypy/pypy/changeset/36c1c430d065/
Log: Don't derive SomeNone from SomePBC diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -453,9 +453,6 @@ attr = s_attr.const descs = list(pbc.descriptions) - if not descs: - return s_ImpossibleValue - first = descs[0] if len(descs) == 1: return first.s_read_attribute(attr) @@ -496,8 +493,6 @@ annotations). """ descs = list(pbc.descriptions) - if not descs: - return s_ImpossibleValue first = descs[0] first.mergecallfamilies(*descs[1:]) diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -513,7 +513,7 @@ else: return kt.__name__ -class SomeNone(SomePBC): +class SomeNone(SomeObject): can_be_None = True subset_of = None knowntype = type(None) diff --git a/rpython/annotator/signature.py b/rpython/annotator/signature.py --- a/rpython/annotator/signature.py +++ b/rpython/annotator/signature.py @@ -106,12 +106,11 @@ for i, argtype in enumerate(self.argtypes): if isinstance(argtype, (types.FunctionType, types.MethodType)): argtype = argtype(*inputcells) - if isinstance(argtype, lltype.LowLevelType) and\ - argtype is lltype.Void: + if argtype is lltype.Void: # XXX the mapping between Void and annotation # is not quite well defined s_input = inputcells[i] - assert isinstance(s_input, annmodel.SomePBC) + assert isinstance(s_input, (annmodel.SomePBC, annmodel.SomeNone)) assert s_input.is_constant() args_s.append(s_input) elif argtype is None: diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -760,9 +760,16 @@ def bind_callables_under(self, classdef, name): return self + def getattr(self, s_attr): + return s_ImpossibleValue + getattr.can_only_throw = [] + def setattr(self, s_attr, s_value): return None + def call(self, args): + return s_ImpossibleValue + def bool_behavior(self, s): s.const = False diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py --- a/rpython/rtyper/annlowlevel.py +++ b/rpython/rtyper/annlowlevel.py @@ -56,6 +56,9 @@ assert s_obj.is_constant(), "ambiguous low-level helper specialization" key.append(KeyComp(s_obj.const)) new_args_s.append(s_obj) + elif isinstance(s_obj, annmodel.SomeNone): + key.append(KeyComp(None)) + new_args_s.append(s_obj) else: new_args_s.append(annmodel.not_const(s_obj)) try: diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py --- a/rpython/rtyper/rtyper.py +++ b/rpython/rtyper/rtyper.py @@ -885,7 +885,7 @@ s_value = rtyper.binding(v, default=annmodel.s_None) if not s_value.is_constant(): raise TyperError("non-constant variable of type Void") - if not isinstance(s_value, annmodel.SomePBC): + if not isinstance(s_value, (annmodel.SomePBC, annmodel.SomeNone)): raise TyperError("non-PBC Void argument: %r", (s_value,)) args_s.append(s_value) else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit