[pypy-svn] r48448 - pypy/branch/pypy-rpython-unicode/rpython/ootypesystem
fijal at codespeak.net
fijal at codespeak.net
Thu Nov 8 22:14:20 CET 2007
Author: fijal
Date: Thu Nov 8 22:14:18 2007
New Revision: 48448
Modified:
pypy/branch/pypy-rpython-unicode/rpython/ootypesystem/rstr.py
Log:
Create proper str2unicode
Modified: pypy/branch/pypy-rpython-unicode/rpython/ootypesystem/rstr.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/ootypesystem/rstr.py (original)
+++ pypy/branch/pypy-rpython-unicode/rpython/ootypesystem/rstr.py Thu Nov 8 22:14:18 2007
@@ -73,8 +73,13 @@
def ll_chr2str(ch):
return ootype.oostring(ch, -1)
- #def ll_str2unicode(s):
- # return ootype.oounicode(s, -1)
+ def ll_str2unicode(s):
+ res = ootype.new(ootype.UnicodeBuilder)
+ lgt = s.ll_strlen()
+ res.ll_allocate(lgt)
+ for i in range(lgt):
+ res.ll_append_char(s.ll_stritem_nonneg(i))
+ return res.ll_build()
def ll_unichr2unicode(ch):
return ootype.oounicode(ch, -1)
More information about the Pypy-commit
mailing list