diff options
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/src/grpc/_adapter/_c/utility.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/python/src/grpc/_adapter/_c/utility.c b/src/python/src/grpc/_adapter/_c/utility.c index 651ed3b0a2..3b004abf3d 100644 --- a/src/python/src/grpc/_adapter/_c/utility.c +++ b/src/python/src/grpc/_adapter/_c/utility.c @@ -169,6 +169,7 @@ int pygrpc_produce_op(PyObject *op, grpc_op *result) { return 0; } c_op.op = type; + c_op.flags = 0; switch (type) { case GRPC_OP_SEND_INITIAL_METADATA: if (!pygrpc_cast_pylist_to_send_metadata( @@ -196,10 +197,11 @@ int pygrpc_produce_op(PyObject *op, grpc_op *result) { return 0; } if (!PyTuple_Check(PyTuple_GET_ITEM(op, STATUS_INDEX))) { - char buf[64]; - snprintf(buf, sizeof(buf), "expected tuple status in op of length %d", - STATUS_TUPLE_SIZE); - PyErr_SetString(PyExc_TypeError, buf); + char *buf; + gpr_asprintf(&buf, "expected tuple status in op of length %d", + STATUS_TUPLE_SIZE); + PyErr_SetString(PyExc_ValueError, buf); + gpr_free(buf); return 0; } c_op.data.send_status_from_server.status = PyInt_AsLong( |