Author gvanrossum
Recipients giampaolo.rodola, gvanrossum, inada.naoki, mpaolini, serhiy.storchaka, vstinner, yselivanov
Date 2016-09-11.04:54:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473569654.97.0.675193164503.issue26081@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks! I can't review the whole thing, but I patched it in and tried running the asyncio/examples/crawl.py example, like so:

$ ~/src/cpython36/python.exe examples/crawl.py xkcd.com -q
Exception RuntimeError('yield was used instead of yield from in task <Task pending coro=<Crawler.fetch() running at examples/crawl.py:778>> with <Future pending cb=[_chain_future.<locals>._call_check_cancel() at /Users/guido/src/cpython36/Lib/asyncio/futures.py:472]>',) for ('xkcd.com', 80)
ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<Crawler.fetch() done, defined at examples/crawl.py:769> exception=RuntimeError('yield was used instead of yield from in task <Task pending coro=<Crawler.fetch() running at examples/crawl.py:778>> with <Future pending cb=[_chain_future.<locals>._call_check_cancel() at /Users/guido/src/cpython36/Lib/asyncio/futures.py:472]>',)>
Traceback (most recent call last):
  File "/Users/guido/src/cpython36/Lib/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "examples/crawl.py", line 778, in fetch
    yield from fetcher.fetch()  # Fetcher gonna fetch.
  File "examples/crawl.py", line 507, in fetch
    yield from self.request.connect()
  File "examples/crawl.py", line 315, in connect
    self.port, self.ssl)
  File "examples/crawl.py", line 143, in get_connection
    ipaddrs = yield from self.loop.getaddrinfo(host, port)
RuntimeError: yield was used instead of yield from in task <Task pending coro=<Crawler.fetch() running at examples/crawl.py:778>> with <Future pending cb=[_chain_future.<locals>._call_check_cancel() at /Users/guido/src/cpython36/Lib/asyncio/futures.py:472]>
*** Report ***
http://xkcd.com no response object
Finished 0 urls in 0.041 secs (max_tasks=100) (0.000 urls/sec/task)
Todo: 0
Busy: 1
Done: 0
Date: Sat Sep 10 21:50:08 2016 local time
Traceback (most recent call last):
  File "examples/crawl.py", line 864, in <module>
    main()
  File "examples/crawl.py", line 852, in main
    loop.run_until_complete(crawler.crawl())  # Crawler gonna crawl.
  File "/Users/guido/src/cpython36/Lib/asyncio/base_events.py", line 438, in run_until_complete
    return future.result()
  File "/Users/guido/src/cpython36/Lib/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "examples/crawl.py", line 766, in crawl
    yield from self.termination.wait()
  File "/Users/guido/src/cpython36/Lib/asyncio/locks.py", line 326, in wait
    yield from fut
RuntimeError: yield was used instead of yield from in task <Task pending coro=<Crawler.crawl() running at examples/crawl.py:766> cb=[_run_until_complete_cb() at /Users/guido/src/cpython36/Lib/asyncio/base_events.py:164]> with <Future pending>

Without your diff, that works, and the output includes this line:

Finished 1786 urls in 7.105 secs (max_tasks=100) (2.514 urls/sec/task)
History
Date User Action Args
2016-09-11 04:54:15gvanrossumsetrecipients: + gvanrossum, vstinner, giampaolo.rodola, inada.naoki, serhiy.storchaka, yselivanov, mpaolini
2016-09-11 04:54:14gvanrossumsetmessageid: <1473569654.97.0.675193164503.issue26081@psf.upfronthosting.co.za>
2016-09-11 04:54:14gvanrossumlinkissue26081 messages
2016-09-11 04:54:13gvanrossumcreate