let str() in Py3 represent the unicode type
authorStefan Behnel <scoder@users.berlios.de>
Sat, 10 Oct 2009 09:18:55 +0000 (11:18 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 10 Oct 2009 09:18:55 +0000 (11:18 +0200)
Cython/Compiler/ModuleNode.py
tests/run/strfunction.pyx

index 07eedde9582c578c4b1098a6f1d8d72dfd1f6b34..7d5d03d7379b9a13f29e0be626883148131ccd22 100644 (file)
@@ -493,7 +493,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
 
         code.putln("#if PY_MAJOR_VERSION >= 3")
         code.putln("  #define PyBaseString_Type            PyUnicode_Type")
-        code.putln("  #define PyString_Type                PyBytes_Type")
+        code.putln("  #define PyString_Type                PyUnicode_Type")
         code.putln("  #define PyString_CheckExact          PyBytes_CheckExact")
         code.putln("  #define PyInt_Type                   PyLong_Type")
         code.putln("  #define PyInt_Check(op)              PyLong_Check(op)")
index 9b7964bd6010a78a4fcc31ad4da1c60c902a78b8..757cfcdc61690f358682575b423a88920b28acf7 100644 (file)
@@ -1,14 +1,14 @@
 __doc__ = u"""
-   >>> s('test', **encoding)
-   b'test'
+   >>> str('test')
+   'test'
    >>> z
-   b'test'
+   'test'
    >>> c('testing')
-   b'testing'
+   'testing'
    >>> sub('testing a subtype')
-   b'testing a subtype'
-   >>> subs('testing a subtype', **encoding)
-   b'testing a subtype'
+   'testing a subtype'
+   >>> subs('testing a subtype')
+   'testing a subtype'
 
 #   >>> csub('testing a subtype')
 #   'testing a subtype'
@@ -16,27 +16,20 @@ __doc__ = u"""
 #   'testing a subtype'
 """
 
-import sys
-if sys.version_info[0] >= 3:
-    encoding = {u'encoding' : u'ASCII'}
-else:
-    encoding = {}
-    __doc__ = __doc__.replace(u" b'", u" '")
-
 s = str
 z = str('test')
 
 def c(string):
-    return str(string, **encoding)
+    return str(string)
 
 class subs(str):
     pass
 
 def sub(string):
-    return subs(string, **encoding)
+    return subs(string)
 
 #cdef class subs(str):
 #    pass
 
 #def csub(string):
-#    return csubs(string, **encoding)
+#    return csubs(string)