[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

Nathaniel Smith report at bugs.python.org
Tue Jan 23 21:11:13 EST 2018


Nathaniel Smith <njs at pobox.com> added the comment:

Ah-hah, I get what's going on.

@asyncio.coroutine has always been buggy: when debug mode is turned on, then it fails to set CO_ITERABLE_COROUTINE.

However, when debug mode is turned on, then traditionally native coroutines got wrapped into CoroWrapper objects. We've always been lazy and reused the same CoroWrapper type for both native coroutines and old-style @asyncio.coroutine coroutines, so CoroWrapper has both coroutine and generator attributes.

This means that until my patch, in debug mode, native coroutines were *getting turned back into generators*. So this hid the bug in @asyncio.coroutine, because it doesn't matter if you can't call native coroutines if you've just turned them into generators.

The fix is trivial, we just need to always use @types.coroutine in @asyncio.coroutine, I'll put up a PR momentarily.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32636>
_______________________________________


More information about the Python-bugs-list mailing list