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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
aee044e8
Commit
aee044e8
authored
Aug 21, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly handle char values (bytes with length 1) in Py3
parent
850c569f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+3
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
aee044e8
...
...
@@ -676,7 +676,7 @@ class CharNode(ConstNode):
return
ord
(
self
.
value
)
def
calculate_result_code
(
self
):
return
"'%s'"
%
StringEncoding
.
escape_char
acter
(
self
.
value
)
return
"'%s'"
%
StringEncoding
.
escape_char
(
self
.
value
)
class
IntNode
(
ConstNode
):
...
...
Cython/Compiler/StringEncoding.py
View file @
aee044e8
...
...
@@ -49,7 +49,7 @@ class BytesLiteralBuilder(object):
self
.
chars
.
append
(
characters
)
def
append_charval
(
self
,
char_number
):
self
.
chars
.
append
(
chr
(
char_number
)
)
self
.
chars
.
append
(
chr
(
char_number
)
.
encode
(
'ISO-8859-1'
)
)
def
getstring
(
self
):
# this *must* return a byte string! => fix it in Py3k!!
...
...
@@ -132,7 +132,8 @@ def _build_specials_test():
_has_specials
=
_build_specials_test
()
def
escape_character
(
c
):
def
escape_char
(
c
):
c
=
c
.
decode
(
'ISO-8859-1'
)
if
c
in
'
\
n
\
r
\
t
\
\
'
:
return
repr
(
c
)[
1
:
-
1
]
elif
c
==
"'"
:
...
...
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