diff --git a/src/confluent_kafka/src/confluent_kafka.c b/src/confluent_kafka/src/confluent_kafka.c index c82dc670f..8bfa999f1 100644 --- a/src/confluent_kafka/src/confluent_kafka.c +++ b/src/confluent_kafka/src/confluent_kafka.c @@ -1620,7 +1620,10 @@ PyObject *c_Node_to_py(const rd_kafka_Node_t *c_node) { cfl_PyDict_SetInt(kwargs, "id", rd_kafka_Node_id(c_node)); cfl_PyDict_SetInt(kwargs, "port", rd_kafka_Node_port(c_node)); - cfl_PyDict_SetString(kwargs, "host", rd_kafka_Node_host(c_node)); + if (rd_kafka_Node_host(c_node)) + cfl_PyDict_SetString(kwargs, "host", rd_kafka_Node_host(c_node)); + else + PyDict_SetItemString(kwargs, "host", Py_None); if((rack = rd_kafka_Node_rack(c_node))) cfl_PyDict_SetString(kwargs, "rack", rack);