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
Boxiang Sun
cython
Commits
d57c269a
Commit
d57c269a
authored
Mar 26, 2016
by
Phil Austin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move bytes decoding to callback
parent
15b2f6db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
Demos/callback/cheese.pyx
Demos/callback/cheese.pyx
+3
-1
Demos/callback/run_cheese.py
Demos/callback/run_cheese.py
+2
-1
No files found.
Demos/callback/cheese.pyx
View file @
d57c269a
...
@@ -10,4 +10,6 @@ def find(f):
...
@@ -10,4 +10,6 @@ def find(f):
find_cheeses
(
callback
,
<
void
*>
f
)
find_cheeses
(
callback
,
<
void
*>
f
)
cdef
void
callback
(
char
*
name
,
void
*
f
):
cdef
void
callback
(
char
*
name
,
void
*
f
):
(
<
object
>
f
)(
name
)
the_name
=
<
bytes
>
name
(
<
object
>
f
)(
the_name
.
decode
(
'utf-8'
))
Demos/callback/run_cheese.py
View file @
d57c269a
import
cheese
import
cheese
def
report_cheese
(
name
):
def
report_cheese
(
name
):
print
(
"Found cheese: "
+
name
.
decode
(
'utf-8'
)
)
print
(
"Found cheese: "
+
name
)
cheese
.
find
(
report_cheese
)
cheese
.
find
(
report_cheese
)
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