[pypy-svn] r71222 - in pypy/trunk/pypy/annotation: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Feb 14 11:18:59 CET 2010
Author: arigo
Date: Sun Feb 14 11:18:58 2010
New Revision: 71222
Modified:
pypy/trunk/pypy/annotation/test/test_annrpython.py
pypy/trunk/pypy/annotation/unaryop.py
Log:
Test and fix.
Modified: pypy/trunk/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/trunk/pypy/annotation/test/test_annrpython.py (original)
+++ pypy/trunk/pypy/annotation/test/test_annrpython.py Sun Feb 14 11:18:58 2010
@@ -485,6 +485,19 @@
assert not isinstance(dictkey(s), annmodel.SomeString)
assert not isinstance(dictvalue(s), annmodel.SomeString)
+ def test_dict_update_2(self):
+ a = self.RPythonAnnotator()
+ def g(n):
+ if n:
+ return {3: 4}
+ def f(n):
+ g(0)
+ d = {}
+ d.update(g(n))
+ return d
+ s = a.build_types(f, [int])
+ assert dictkey(s).knowntype == int
+
def test_dict_keys(self):
a = self.RPythonAnnotator()
s = a.build_types(snippet.dict_keys, [])
Modified: pypy/trunk/pypy/annotation/unaryop.py
==============================================================================
--- pypy/trunk/pypy/annotation/unaryop.py (original)
+++ pypy/trunk/pypy/annotation/unaryop.py Sun Feb 14 11:18:58 2010
@@ -409,6 +409,8 @@
return SomeDict(dct.dictdef)
def method_update(dct1, dct2):
+ if s_None.contains(dct2):
+ return SomeImpossibleValue()
dct1.dictdef.union(dct2.dictdef)
def method_keys(dct):
More information about the Pypy-commit
mailing list