From 58c2739dee7d90decad190c0fb71b5c80328b67e Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 21 Mar 2019 14:44:41 +0100 Subject: [PATCH] If fd is -1 in pysock_op_iternext just return None. None in pysock signals EOF and if it was closed under our feet we should relay that properly. --- src/python.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python.c b/src/python.c index ff4166b..4f98bd5 100644 --- a/src/python.c +++ b/src/python.c @@ -2066,6 +2066,11 @@ pysocket_op_iternext(struct pysocket_op *op) { PyObject *ret; + if (op->socket->fd == -1) { + PyErr_SetNone(PyExc_StopIteration); + return (NULL); + } + if (op->eof) { if (op->coro->exception != NULL) { PyErr_SetString(op->coro->exception,