diff --git a/uvloop/handles/stream.pyx b/uvloop/handles/stream.pyx index 96123b5..1842e10 100644 --- a/uvloop/handles/stream.pyx +++ b/uvloop/handles/stream.pyx @@ -373,6 +373,11 @@ cdef class UVStream(UVBaseTransport): int err _StreamWriteContext ctx + if self._closed: + # If the handle is closed, just return, it's too + # late to do anything. + return + ctx = _StreamWriteContext.new(self, self._buffer) if ctx.py_bufs_sml_inuse: