Skip to content

Commit

Permalink
Merge pull request grpc#1895 from nicolasnoble/python-is-not-c89
Browse files Browse the repository at this point in the history
Some compilers don't like C99.
  • Loading branch information
soltanmm committed Jun 4, 2015
2 parents 5dedc98 + 3f6d351 commit aa152ef
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/python/src/grpc/_adapter/_c/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ int pygrpc_produce_op(PyObject *op, grpc_op *result) {
static const int STATUS_INDEX = 4;
static const int STATUS_CODE_INDEX = 0;
static const int STATUS_DETAILS_INDEX = 1;
int type;
Py_ssize_t message_size;
char *message;
char *status_details;
gpr_slice message_slice;
grpc_op c_op;
if (!PyTuple_Check(op)) {
PyErr_SetString(PyExc_TypeError, "expected tuple op");
Expand All @@ -156,14 +161,10 @@ int pygrpc_produce_op(PyObject *op, grpc_op *result) {
PyErr_SetString(PyExc_ValueError, buf);
return 0;
}
int type = PyInt_AsLong(PyTuple_GET_ITEM(op, TYPE_INDEX));
type = PyInt_AsLong(PyTuple_GET_ITEM(op, TYPE_INDEX));
if (PyErr_Occurred()) {
return 0;
}
Py_ssize_t message_size;
char *message;
char *status_details;
gpr_slice message_slice;
c_op.op = type;
switch (type) {
case GRPC_OP_SEND_INITIAL_METADATA:
Expand Down Expand Up @@ -366,7 +367,9 @@ gpr_timespec pygrpc_cast_double_to_gpr_timespec(double seconds) {
int pygrpc_produce_channel_args(PyObject *py_args, grpc_channel_args *c_args) {
size_t num_args = PyList_Size(py_args);
size_t i;
grpc_channel_args args = {num_args, gpr_malloc(sizeof(grpc_arg) * num_args)};
grpc_channel_args args;
args.num_args = num_args;
args.args = gpr_malloc(sizeof(grpc_arg) * num_args);
for (i = 0; i < args.num_args; ++i) {
char *key;
PyObject *value;
Expand Down

0 comments on commit aa152ef

Please sign in to comment.