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
Gwenaël Samain
cython
Commits
0d632d87
Commit
0d632d87
authored
Jul 06, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable % formatting of byte strings by providing a __str__() special method that encodes to unicode
parent
e6a1d09b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+3
-3
No files found.
Cython/Compiler/ModuleNode.py
View file @
0d632d87
...
...
@@ -592,7 +592,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
includes
=
[]
for
filename
in
env
.
include_files
:
# fake decoding of filenames to their original byte sequence
code
.
putln
(
'#include "%s"'
%
filename
.
as_unicode
()
)
code
.
putln
(
'#include "%s"'
%
filename
)
def
generate_filename_table
(
self
,
code
):
code
.
putln
(
""
)
...
...
Cython/Compiler/StringEncoding.py
View file @
0d632d87
...
...
@@ -89,9 +89,9 @@ class BytesLiteral(_bytes):
def
utf8encode
(
self
):
assert
False
,
"this is not a unicode string: %r"
%
self
def
as_unicode
(
self
):
"""
Returns a Unicode sequence that matches the byte sequence
of this literal
.
def
__str__
(
self
):
"""
Fake-decode the byte string to unicode to support %
formatting of unicode strings
.
"""
return
self
.
decode
(
'ISO-8859-1'
)
...
...
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