[pypy-svn] r19657 - in pypy/branch/somepbc-refactoring/pypy: annotation translator/test
arigo at codespeak.net
arigo at codespeak.net
Tue Nov 8 20:09:40 CET 2005
Author: arigo
Date: Tue Nov 8 20:09:38 2005
New Revision: 19657
Modified:
pypy/branch/somepbc-refactoring/pypy/annotation/description.py
pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py
pypy/branch/somepbc-refactoring/pypy/translator/test/test_annrpython.py
Log:
(arigo, mwh, pedronis)
fixed is_true annotation of PBC
shallow first failure in emulated_pbc_call tests
Modified: pypy/branch/somepbc-refactoring/pypy/annotation/description.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/description.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/description.py Tue Nov 8 20:09:38 2005
@@ -219,6 +219,7 @@
super(FrozenDesc, self).__init__(bookkeeper, pyobj)
self.attributes = self.pyobj.__dict__.copy()
self.knowntype = new_or_old_class(pyobj)
+ assert bool(pyobj), "__nonzero__ unsupported on frozen PBC %r" %(pyobj,)
def s_read_attribute(self, attr):
if attr in self.attributes:
Modified: pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py Tue Nov 8 20:09:38 2005
@@ -513,19 +513,12 @@
return SomePBC(d, can_be_None=pbc.can_be_None)
def is_true_behavior(pbc):
- FIXME_BY_THE_WAY
- outcome = None
- for c in pbc.prebuiltinstances:
- if c is not None and not bool(c):
- getbookkeeper().warning("PBC %r has truth value False" % (c,))
- getbookkeeper().count("pbc_is_true", pbc)
- for c in pbc.prebuiltinstances:
- if outcome is None:
- outcome = bool(c)
- else:
- if outcome != bool(c):
- return SomeBool()
- return immutablevalue(outcome)
+ if pbc.isNone():
+ return immutablevalue(False)
+ elif pbc.can_be_None:
+ return SomeBool()
+ else:
+ return immutablevalue(True)
class __extend__(SomeExternalObject):
Modified: pypy/branch/somepbc-refactoring/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/test/test_annrpython.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/test/test_annrpython.py Tue Nov 8 20:09:38 2005
@@ -1664,14 +1664,14 @@
return f(a1)
a = self.RPythonAnnotator()
s = a.build_types(g, [int])
- assert None not in s.prebuiltinstances
+ assert not s.can_be_None
def test_emulated_pbc_call_simple(self):
def f(a,b):
return a + b
from pypy.translator import translator
from pypy.translator import annrpython
- a = annrpython.RPythonAnnotator(translator.Translator(simplifying=True))
+ a = annrpython.RPythonAnnotator()
from pypy.annotation import model as annmodel
s_f = a.bookkeeper.immutablevalue(f)
@@ -1686,7 +1686,7 @@
return a + b
from pypy.translator import translator
from pypy.translator import annrpython
- a = annrpython.RPythonAnnotator(translator.Translator(simplifying=True))
+ a = annrpython.RPythonAnnotator()
from pypy.annotation import model as annmodel
memo = []
More information about the Pypy-commit
mailing list