Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin client impl fixes #1823

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/confluent_kafka/src/Admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2305,8 +2305,8 @@ PyObject *Admin_describe_topics (Handle *self, PyObject *args, PyObject *kwargs)
int topics_cnt = 0;
int i = 0;

static char *kws[] = {"future",
"topic_names",
static char *kws[] = {"topic_names",
"future",
/* options */
"request_timeout",
"include_authorized_operations",
Expand Down Expand Up @@ -2650,10 +2650,15 @@ PyObject *Admin_list_consumer_group_offsets (Handle *self, PyObject *args, PyObj
* admin operation is finished, so we need to keep our own refcount. */
Py_INCREF(future);

if (PyList_Check(request) &&
(requests_cnt = (int)PyList_Size(request)) != 1) {
PyErr_SetString(PyExc_ValueError,
"Currently we support listing only 1 consumer groups offset information");
if (PyList_Check(request)) {
if ((int)PyList_Size(request) != 1) {
PyErr_SetString(PyExc_ValueError,
"Currently we support listing only 1 consumer groups offset inforation");
goto err;
}
} else {
PyErr_SetString(PyExc_TypeError,
"Expected 'request' to be a list");
goto err;
}

Expand Down Expand Up @@ -2789,10 +2794,15 @@ PyObject *Admin_alter_consumer_group_offsets (Handle *self, PyObject *args, PyOb
* admin operation is finished, so we need to keep our own refcount. */
Py_INCREF(future);

if (PyList_Check(request) &&
(requests_cnt = (int)PyList_Size(request)) != 1) {
PyErr_SetString(PyExc_ValueError,
"Currently we support alter consumer groups offset request for 1 group only");
if (PyList_Check(request)) {
if ((int)PyList_Size(request) != 1) {
PyErr_SetString(PyExc_ValueError,
"Currently we support alter consumer groups offset request for 1 group only");
goto err;
}
} else {
PyErr_SetString(PyExc_TypeError,
"Expected 'request' to be a list");
goto err;
}

Expand Down
4 changes: 2 additions & 2 deletions src/confluent_kafka/src/confluent_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,8 +1330,8 @@ rd_kafka_topic_partition_list_t *py_to_c_parts (PyObject *plist) {
TopicPartition *tp = (TopicPartition *)
PyList_GetItem(plist, i);

if (PyObject_Type((PyObject *)tp) !=
(PyObject *)&TopicPartitionType) {
if (PyObject_TypeCheck((PyObject *)tp,
(PyObject *)&TopicPartitionType) == 0) {
PyErr_Format(PyExc_TypeError,
"expected %s",
TopicPartitionType.tp_name);
Expand Down