commit 58c2739dee7d90decad190c0fb71b5c80328b67e
parent 370041656e5becae517610726eff2697a5681408
Author: Joris Vink <joris@coders.se>
Date: Thu, 21 Mar 2019 14:44:41 +0100
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.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git 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,