Skip to content

Commit

Permalink
Encode values from python callback for C++ (#10103)
Browse files Browse the repository at this point in the history
Bug: This is currently throwing exceptions due to cython failing to encode the responses from the python callback automatically.

Authors:
  - Jeremy Dyer (https://github.com/jdye64)

Approvers:
  - https://github.com/brandon-b-miller
  - https://github.com/jsmaupin
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: #10103
  • Loading branch information
jdye64 authored Jan 24, 2022
1 parent 01b7c83 commit cfb6cbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Binary file removed python/cudf_kafka/cudf_kafka/_lib/.kafka.pxd.swo
Binary file not shown.
7 changes: 6 additions & 1 deletion python/cudf_kafka/cudf_kafka/_lib/kafka.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ from cudf_kafka._lib.kafka cimport kafka_consumer
# To avoid including <python.h> in libcudf_kafka
# we introduce this wrapper in Cython
cdef map[string, string] oauth_callback_wrapper(void *ctx):
return (<object>(ctx))()
resp = (<object>(ctx))()
cdef map[string, string] c_resp
c_resp[str.encode("token")] = str.encode(resp["token"])
c_resp[str.encode("token_expiration_in_epoch")] \
= str(resp["token_expiration_in_epoch"]).encode()
return c_resp


cdef class KafkaDatasource(Datasource):
Expand Down

0 comments on commit cfb6cbe

Please sign in to comment.