File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,20 @@ cdef class UVStream(UVBaseTransport):
184184 Py_buffer py_buf
185185
186186 fd = self ._fileno()
187- PyObject_GetBuffer(data, & py_buf, PyBUF_SIMPLE)
188- written = system.send(fd, < char * > py_buf.buf, py_buf.len, 0 )
189- PyBuffer_Release(& py_buf)
187+
188+ if PyBytes_CheckExact(data):
189+ written = system.send(fd, PyBytes_AS_STRING(data),
190+ Py_SIZE(data), 0 )
191+
192+ elif PyByteArray_CheckExact(data):
193+ written = system.send(fd, PyByteArray_AS_STRING(data),
194+ Py_SIZE(data), 0 )
195+
196+ else :
197+ PyObject_GetBuffer(data, & py_buf, PyBUF_SIMPLE)
198+ written = system.send(fd, < char * > py_buf.buf, py_buf.len, 0 )
199+ PyBuffer_Release(& py_buf)
200+
190201 if written < 0 :
191202 if errno.errno not in (system.EINTR, system.EAGAIN,
192203 system.EWOULDBLOCK, system.EINPROGRESS,
You can’t perform that action at this time.
0 commit comments