[issue29701] Add close method to queue.Queue

2017-03-02 Thread Mathias Fröjdman
New submission from Mathias Fröjdman: queue.Queue should have a close() method. The result of calling the method would be to raise a new exception - queue.Closed, for any subsequent calls to Queue.put, and after the queue is empty, also for Queue.get. Why: To allow producers (callers

[issue24795] Make event loops with statement context managers

2015-08-05 Thread Mathias Fröjdman
New submission from Mathias Fröjdman: Since asyncio event loops have to be closed nowadays, it would be pretty convenient and pythonic to make BaseEventLoop a context manager that calls self.close() in __exit__ the same way as contextlib.closing() does it. Example: import asyncio

[issue24795] Make event loops with statement context managers

2015-08-05 Thread Mathias Fröjdman
Mathias Fröjdman added the comment: (Just noticed http://bugs.python.org/issue19860, which I originally failed to notice when just searching for asyncio loop and not context manager) Anyway, in recent Python/asyncio versions, failing to close the event loop before exiting whole the process

[issue23837] read pipe transport tries to resume reading after loop is gone

2015-04-01 Thread Mathias Fröjdman
New submission from Mathias Fröjdman: Script attached which reproduces the issue. Steps to reproduce: 0) Use python 3.4.3 on Linux. Does not repro with 3.4.0 or 3.4.2. 1) Create a child process with asyncio.create_child_exec and stdout=PIPE 2) loop yield from child.read(n) (i used n=2048, any