[pypy-svn] r73763 - in pypy/trunk/pypy/objspace/flow: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Apr 15 13:17:46 CEST 2010
Author: arigo
Date: Thu Apr 15 13:17:44 2010
New Revision: 73763
Modified:
pypy/trunk/pypy/objspace/flow/objspace.py
pypy/trunk/pypy/objspace/flow/test/test_objspace.py
Log:
Test and fix.
Modified: pypy/trunk/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/objspace.py (original)
+++ pypy/trunk/pypy/objspace/flow/objspace.py Thu Apr 15 13:17:44 2010
@@ -492,6 +492,7 @@
float: [ValueError],
chr: [ValueError],
unichr: [ValueError],
+ unicode: [UnicodeDecodeError],
# specifying IndexError, and KeyError beyond Exception,
# allows the annotator to be more precise, see test_reraiseAnything/KeyError in
# the annotator tests
Modified: pypy/trunk/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/test/test_objspace.py (original)
+++ pypy/trunk/pypy/objspace/flow/test/test_objspace.py Thu Apr 15 13:17:44 2010
@@ -1,7 +1,7 @@
import new
import py
from pypy.objspace.flow.model import Constant, Block, Link, Variable, traverse
-from pypy.objspace.flow.model import flatten, mkentrymap
+from pypy.objspace.flow.model import flatten, mkentrymap, c_last_exception
from pypy.interpreter.argument import Arguments
from pypy.translator.simplify import simplify_graph
from pypy.objspace.flow.objspace import FlowObjSpace
@@ -728,7 +728,18 @@
return unicode("1234")
graph = self.codetest(myfunc)
assert graph.startblock.exits[0].target is graph.returnblock
-
+
+ def test_unicode(self):
+ def myfunc(n):
+ try:
+ return unicode(chr(n))
+ except UnicodeDecodeError:
+ return None
+ graph = self.codetest(myfunc)
+ simplify_graph(graph)
+ assert graph.startblock.exitswitch == c_last_exception
+ assert graph.startblock.exits[0].target is graph.returnblock
+ assert graph.startblock.exits[1].target is graph.returnblock
def test_getitem(self):
def f(c, x):
More information about the Pypy-commit
mailing list