Stefan Behnel added the comment:

I was (silently) hoping that this patching would eventually not be necessary 
anymore because the one place (currently inspect.isgenerator()) would be 
adapted to check for the generator protocol rather than the generator type. But 
that was going to go into a separate ticket. :)

I'm not sure inspect.isgenerator() is the right place, though, as the module 
tends to deal with types, not protocols. I think the right fix overall would be 
a Generator ABC class that defines the protocol.

What Cython does now in order to make asyncio work with Cython compiled 
generators is this:

https://github.com/cython/cython/blob/4af42443bd37f6207143f8870904f780a65bb3e3/Cython/Utility/Generator.c#L824

https://github.com/cython/cython/blob/4af42443bd37f6207143f8870904f780a65bb3e3/Cython/Utility/Generator.c#L906

Aweful, but currently required due to the type check, which prevents objects 
that implement the generator protocol from being handled correctly by asyncio.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24004>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to