aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-06-03 18:27:57 -0700
committerGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-06-03 18:27:57 -0700
commitaa152ef420f61380079fb269c78e31cacb4253c7 (patch)
treeb302b461761ccb364aa275ee4fe0b7c6ec792348 /src/python
parent5dedc9883dbe14f0e2687343a3e02a5d4c2809d4 (diff)
parent3f6d351b868bb65a543aedbe8da73a32bfe538d8 (diff)
Merge pull request #1895 from nicolasnoble/python-is-not-c89
Some compilers don't like C99.
Diffstat (limited to 'src/python')
-rw-r--r--src/python/src/grpc/_adapter/_c/utility.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/python/src/grpc/_adapter/_c/utility.c b/src/python/src/grpc/_adapter/_c/utility.c
index 42d3370cf2..ced34a6816 100644
--- a/src/python/src/grpc/_adapter/_c/utility.c
+++ b/src/python/src/grpc/_adapter/_c/utility.c
@@ -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");
@@ -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:
@@ -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;