[Twisted-Python] defer.inlineCallbacks dosn't work with cython, deferredGenerator does.

gelin yan dynamicgl at gmail.com
Mon Apr 9 22:41:17 MDT 2012


On Tue, Apr 10, 2012 at 4:01 AM, Glyph Lefkowitz <glyph at twistedmatrix.com>wrote:

> On Apr 9, 2012, at 3:05 AM, gelin yan wrote:
>
> I personally hope deferredGenerator will be always there even python 2.4
> support has been abandoned. deferredGenerator itself is not so elegant as
> inlineCallbacks, at least I don't need to struggle with a series of
> callback functions..
>
>
> We would like to get rid of deferredGenerator eventually; it's worse than
> inlineCallbacks in pretty much every way.  It sounds like you have
> discovered a bug though, either in Twisted, or, more likely, in Cython.
>  Please narrow down the bug so it can be fixed and you can start using
> inlineCallbacks in Cython.
>
> For now, just keep an eye on new deferredGenerator tickets and comment on
> any that appear to request its removal; there's an RSS feed at <
> http://twistedmatrix.com/trac/timeline> which may be useful to you for
> that.  If you put a comment on any such ticket I'm sure we can wait a while
> for Cython to fix the bug.
>
> -glyph
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Hi Glyph

    When trying to run inlineCallbacks with Cython, a TypeError would come
out like:

TypeError: inlineCallbacks requires <built-in function test> to produce a
generator; instead got <cy3.__pyx_scope_struct__test object at 0x02808848)

test is the function where inlineCallbacks uses.

It looks like cython changes the name test to  cy3.__pyx_scope_struct__test
internally so generator can't work properly.


Regards

gelin yan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20120410/74a9dd09/attachment.html>


More information about the Twisted-Python mailing list