Adapting Python.

pull/2612/head
Nicolas "Pixel" Noble 9 years ago
parent 150b7c4f5d
commit 6002a4f67b
  1. 6
      src/python/src/grpc/_adapter/_c/types/call.c
  2. 4
      src/python/src/grpc/_adapter/_c/types/channel.c
  3. 4
      src/python/src/grpc/_adapter/_c/types/completion_queue.c

@ -131,7 +131,7 @@ PyObject *pygrpc_Call_start_batch(Call *self, PyObject *args, PyObject *kwargs)
} }
} }
tag = pygrpc_produce_batch_tag(user_tag, self, ops, nops); tag = pygrpc_produce_batch_tag(user_tag, self, ops, nops);
errcode = grpc_call_start_batch(self->c_call, tag->ops, tag->nops, tag); errcode = grpc_call_start_batch(self->c_call, tag->ops, tag->nops, tag, NULL);
gpr_free(ops); gpr_free(ops);
return PyInt_FromLong(errcode); return PyInt_FromLong(errcode);
} }
@ -151,13 +151,13 @@ PyObject *pygrpc_Call_cancel(Call *self, PyObject *args, PyObject *kwargs) {
return NULL; return NULL;
} }
code = PyInt_AsLong(py_code); code = PyInt_AsLong(py_code);
errcode = grpc_call_cancel_with_status(self->c_call, code, details); errcode = grpc_call_cancel_with_status(self->c_call, code, details, NULL);
} else if (py_code != NULL || details != NULL) { } else if (py_code != NULL || details != NULL) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"if `code` is specified, so must `details`"); "if `code` is specified, so must `details`");
return NULL; return NULL;
} else { } else {
errcode = grpc_call_cancel(self->c_call); errcode = grpc_call_cancel(self->c_call, NULL);
} }
return PyInt_FromLong(errcode); return PyInt_FromLong(errcode);
} }

@ -104,7 +104,7 @@ Channel *pygrpc_Channel_new(
if (creds) { if (creds) {
self->c_chan = grpc_secure_channel_create(creds->c_creds, target, &c_args); self->c_chan = grpc_secure_channel_create(creds->c_creds, target, &c_args);
} else { } else {
self->c_chan = grpc_channel_create(target, &c_args); self->c_chan = grpc_channel_create(target, &c_args, NULL);
} }
pygrpc_discard_channel_args(c_args); pygrpc_discard_channel_args(c_args);
return self; return self;
@ -129,6 +129,6 @@ Call *pygrpc_Channel_create_call(
call = pygrpc_Call_new_empty(cq); call = pygrpc_Call_new_empty(cq);
call->c_call = grpc_channel_create_call( call->c_call = grpc_channel_create_call(
self->c_chan, cq->c_cq, method, host, self->c_chan, cq->c_cq, method, host,
pygrpc_cast_double_to_gpr_timespec(deadline)); pygrpc_cast_double_to_gpr_timespec(deadline), NULL);
return call; return call;
} }

@ -90,7 +90,7 @@ PyTypeObject pygrpc_CompletionQueue_type = {
CompletionQueue *pygrpc_CompletionQueue_new( CompletionQueue *pygrpc_CompletionQueue_new(
PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyTypeObject *type, PyObject *args, PyObject *kwargs) {
CompletionQueue *self = (CompletionQueue *)type->tp_alloc(type, 0); CompletionQueue *self = (CompletionQueue *)type->tp_alloc(type, 0);
self->c_cq = grpc_completion_queue_create(); self->c_cq = grpc_completion_queue_create(NULL);
return self; return self;
} }
@ -111,7 +111,7 @@ PyObject *pygrpc_CompletionQueue_next(
} }
Py_BEGIN_ALLOW_THREADS; Py_BEGIN_ALLOW_THREADS;
event = grpc_completion_queue_next( event = grpc_completion_queue_next(
self->c_cq, pygrpc_cast_double_to_gpr_timespec(deadline)); self->c_cq, pygrpc_cast_double_to_gpr_timespec(deadline), NULL);
Py_END_ALLOW_THREADS; Py_END_ALLOW_THREADS;
transliterated_event = pygrpc_consume_event(event); transliterated_event = pygrpc_consume_event(event);
return transliterated_event; return transliterated_event;

Loading…
Cancel
Save