This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vajrasky
Recipients docs@python, vajrasky, vstinner
Date 2014-02-17.06:33:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392618802.39.0.436656290548.issue20652@psf.upfronthosting.co.za>
In-reply-to
Content
From http://docs.python.org/3.4/library/asyncio-task.html#example-future-with-run-until-complete

there is an example code:
import asyncio

@asyncio.coroutine
def slow_operation(future):
    yield from asyncio.sleep(1)
    future.set_result('Future in done!')

def got_result(future):
    print(future.result())
    loop.stop()

loop = asyncio.get_event_loop()
future = asyncio.Future()
asyncio.Task(slow_operation(future))
future.add_done_callback(got_result)
loop.run_forever()


I got this:
ethan@amiau:~/Documents/code/python/cpython3.4$ ./python /tmp/demo.py
Future in done!
sys:1: ResourceWarning: unclosed <socket object at 0x7feb49df1058>
sys:1: ResourceWarning: unclosed <socket object at 0x7feb493b48c8>

Here is the patch to shut off the resource warning.
History
Date User Action Args
2014-02-17 06:33:22vajraskysetrecipients: + vajrasky, vstinner, docs@python
2014-02-17 06:33:22vajraskysetmessageid: <1392618802.39.0.436656290548.issue20652@psf.upfronthosting.co.za>
2014-02-17 06:33:22vajraskylinkissue20652 messages
2014-02-17 06:33:21vajraskycreate