Skip to content

Commit 271483d

Browse files
hqinedenhill
authored andcommitted
Fix open issue #73 -- TopicPartition_str0 broken on Mac OS X (#83)
1 parent 406a2bd commit 271483d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

confluent_kafka/src/confluent_kafka.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,13 @@ static PyObject *TopicPartition_str0 (TopicPartition *self) {
636636
PyObject *errstr = self->error == Py_None ? NULL :
637637
cfl_PyObject_Unistr(self->error);
638638
PyObject *ret;
639+
char offset_str[40];
640+
snprintf(offset_str, sizeof(offset_str), "%"PRId64"", self->offset);
639641
ret = cfl_PyUnistr(
640642
_FromFormat("TopicPartition{topic=%s,partition=%"PRId32
641-
",offset=%"PRId64",error=%s}",
643+
",offset=%s,error=%s}",
642644
self->topic, self->partition,
643-
self->offset,
645+
offset_str,
644646
errstr ? cfl_PyUnistr_AsUTF8(errstr) : "None"));
645647
if (errstr)
646648
Py_DECREF(errstr);

0 commit comments

Comments
 (0)