From 83ae4ef92118b439140784e0c391dd447944ff79 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 18 May 2016 12:18:12 -0400 Subject: [PATCH] stream: Return early in stream._exec_write if the handle is closed --- uvloop/handles/stream.pyx | 5 +++++ 1 file changed, 5 insertions(+) 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: