[pypy-svn] r48325 - in pypy/branch/pypy-rpython-unicode: interpreter objspace/flow objspace/flow/test
fijal at codespeak.net
fijal at codespeak.net
Mon Nov 5 21:05:57 CET 2007
Author: fijal
Date: Mon Nov 5 21:05:56 2007
New Revision: 48325
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:
Support for constant-folding of unichr
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:05:56 2007
@@ -910,6 +910,7 @@
('issubtype', 'issubtype', 2, []), # not for old-style classes
('repr', 'repr', 1, ['__repr__']),
('str', 'str', 1, ['__str__']),
+ ('unichr', 'unichr', 1, []),
('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:05:56 2007
@@ -149,6 +149,7 @@
('issubtype', issubclass),
('repr', repr),
('str', str),
+ ('unichr', unichr),
('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:05:56 2007
@@ -712,6 +712,12 @@
return x[s]
graph = self.codetest(myfunc)
+ def test_unichr_constfold(self):
+ def myfunc():
+ return unichr(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-commit
mailing list