Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
78ef8342
Commit
78ef8342
authored
Oct 10, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let str() in Py3 represent the unicode type
parent
04f8cc68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
18 deletions
+11
-18
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
tests/run/strfunction.pyx
tests/run/strfunction.pyx
+10
-17
No files found.
Cython/Compiler/ModuleNode.py
View file @
78ef8342
...
...
@@ -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 Py
Bytes
_Type"
)
code
.
putln
(
" #define PyString_Type Py
Unicode
_Type"
)
code
.
putln
(
" #define PyString_CheckExact PyBytes_CheckExact"
)
code
.
putln
(
" #define PyInt_Type PyLong_Type"
)
code
.
putln
(
" #define PyInt_Check(op) PyLong_Check(op)"
)
...
...
tests/run/strfunction.pyx
View file @
78ef8342
__doc__
=
u"""
>>> s
('test', **encoding
)
b
'test'
>>> s
tr('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)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment