Commit d57c269a authored by Phil Austin's avatar Phil Austin

move bytes decoding to callback

parent 15b2f6db
...@@ -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'))
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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment