aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-22 20:03:07 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-22 20:03:07 -0700
commite3af44e2e93620a05f502c44e3711dd22716da79 (patch)
treee38bbfec270148e7485bc085d13a6c1ebded3665 /src
parent39fd22193bedbef97412c857c2d2f73eb5752d2c (diff)
parentce379382552e118a499db95c0d311849557d0227 (diff)
Merge pull request #5914 from thought-machine/fix_slow_string_read
Make grpc-python ByteBuffer.bytes() linear
Diffstat (limited to 'src')
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index 851389a261..6ecdcf7222 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -254,7 +254,7 @@ cdef class ByteBuffer:
if self.c_byte_buffer != NULL:
with nogil:
grpc_byte_buffer_reader_init(&reader, self.c_byte_buffer)
- result = b""
+ result = bytearray()
with nogil:
while grpc_byte_buffer_reader_next(&reader, &data_slice):
data_slice_pointer = gpr_slice_start_ptr(data_slice)
@@ -263,7 +263,7 @@ cdef class ByteBuffer:
result += (<char *>data_slice_pointer)[:data_slice_length]
with nogil:
grpc_byte_buffer_reader_destroy(&reader)
- return result
+ return bytes(result)
else:
return None