[pypy-svn] r12779 - pypy/dist/pypy/translator/c

tismer at codespeak.net tismer at codespeak.net
Wed May 25 01:26:05 CEST 2005


Author: tismer
Date: Wed May 25 01:26:05 2005
New Revision: 12779

Modified:
   pypy/dist/pypy/translator/c/pyobj.py
Log:
added unicode support

btw.: I'm going to abuse this module for pickling.
This is temporary and intentional, just to trigger
considering, that this module is not unique to C,
but a general base thing.

Modified: pypy/dist/pypy/translator/c/pyobj.py
==============================================================================
--- pypy/dist/pypy/translator/c/pyobj.py	(original)
+++ pypy/dist/pypy/translator/c/pyobj.py	Wed May 25 01:26:05 2005
@@ -116,14 +116,11 @@
 
     def nameof_str(self, value):
         name = self.uniquename('gstr_' + value[:32])
-##        if [c for c in value if c<' ' or c>'~' or c=='"' or c=='\\']:
-##            # non-printable string
-##            s = 'chr_%s' % name
-##            self.globaldecl.append('static char %s[] = { %s };' % (
-##                s, ', '.join(['%d' % ord(c) for c in value])))
-##        else:
-##            # printable string
-##            s = '"%s"' % value
+        self.initcode_python(name, repr(value))
+        return name
+
+    def nameof_unicode(self, value):
+        name = self.uniquename('guni_' + str(value[:32]))
         self.initcode_python(name, repr(value))
         return name
 



More information about the Pypy-commit mailing list