[pypy-svn] r48326 - in pypy/branch/pypy-rpython-unicode: interpreter objspace/flow objspace/flow/test
fijal at codespeak.net
fijal at codespeak.net
Mon Nov 5 21:07:58 CET 2007
Author: fijal
Date: Mon Nov 5 21:07:56 2007
New Revision: 48326
Modified:
pypy/branch/pypy-rpython-unicode/interpreter/baseobjspace.py
pypy/branch/pypy-rpython-unicode/objspace/flow/operation.py
pypy/branch/pypy-rpython-unicode/objspace/flow/test/test_objspace.py
Log:
Constant folding for unicode as well
Modified: pypy/branch/pypy-rpython-unicode/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/interpreter/baseobjspace.py (original)
+++ pypy/branch/pypy-rpython-unicode/interpreter/baseobjspace.py Mon Nov 5 21:07:56 2007
@@ -911,6 +911,7 @@
('repr', 'repr', 1, ['__repr__']),
('str', 'str', 1, ['__str__']),
('unichr', 'unichr', 1, []),
+ ('unicode', 'unicode', 1, ['__unicode__']),
('len', 'len', 1, ['__len__']),
('hash', 'hash', 1, ['__hash__']),
('getattr', 'getattr', 2, ['__getattribute__']),
Modified: pypy/branch/pypy-rpython-unicode/objspace/flow/operation.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/objspace/flow/operation.py (original)
+++ pypy/branch/pypy-rpython-unicode/objspace/flow/operation.py Mon Nov 5 21:07:56 2007
@@ -150,6 +150,7 @@
('repr', repr),
('str', str),
('unichr', unichr),
+ ('unicode', unicode),
('len', len),
('hash', hash),
('getattr', getattr),
Modified: pypy/branch/pypy-rpython-unicode/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/objspace/flow/test/test_objspace.py (original)
+++ pypy/branch/pypy-rpython-unicode/objspace/flow/test/test_objspace.py Mon Nov 5 21:07:56 2007
@@ -718,6 +718,13 @@
graph = self.codetest(myfunc)
assert graph.startblock.exits[0].target is graph.returnblock
+ def test_unicode_constfold(self):
+ def myfunc():
+ return unicode(1234)
+ graph = self.codetest(myfunc)
+ assert graph.startblock.exits[0].target is graph.returnblock
+
+
def test_getitem(self):
def f(c, x):
try:
More information about the pypy-svn
mailing list