Author yselivanov
Recipients asvetlov, gvanrossum, ncoghlan, python-dev, scoder, vstinner, yselivanov
Date 2015-05-28.16:42:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432831349.2.0.0262735778156.issue24017@psf.upfronthosting.co.za>
In-reply-to
Content
Stefan,


I've already committed fixes for:

1. getawaitablefunc / aiternextfunc / getaiterfunc -> unaryfunc
2. strange code in tasks.py doing "coro = iter(coro)" is now removed


I've also opened a couple of new issues (with patches for a review):

1. abc.Coroutine derived from abc.Awaitable: issue 24315
2. types.coroutine() to support Cython objects: issue 24316


I'll reply to some of your messages below:

> Another question: is it ok if Cython implements and uses the "tp_as_async" slot in all Py3.x versions (3.2+)? It shouldn't hurt, [..]

I think it's totally OK, given that you can workaround the drawback you mentioned.


>> Can't your Coroutine object return itself from its __await__, and implement 
>> __next__?  Like genobject in CPython simply returns self from its __iter__.

> That was my first try, sure, and it mostly worked. It has a drawback,
> though: it's an incomplete implementation of the Iterator protocol. It's
> still (mostly) an Iterator, but not an Iterable, so it depends on how you
> use it whether you notice or not, and whether it works at all with other
> code or not. There's a test for a failing "next(coro)" in your test suite,
> for example, which would then not fail in Cython. [..]

I think if "next(cython_coro)" does not fail is acceptable.  It's not ideal, but
the purpose of Cython is to make Python code as fast as possible, so I'd try
to avoid having any kind of "thin wrappers" around Cyhton coroutines.
History
Date User Action Args
2015-05-28 16:42:29yselivanovsetrecipients: + yselivanov, gvanrossum, ncoghlan, scoder, vstinner, asvetlov, python-dev
2015-05-28 16:42:29yselivanovsetmessageid: <1432831349.2.0.0262735778156.issue24017@psf.upfronthosting.co.za>
2015-05-28 16:42:29yselivanovlinkissue24017 messages
2015-05-28 16:42:29yselivanovcreate