-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/27/2014 11:55 AM, Victor Stinner wrote: > 2014-03-27 9:25 GMT+01:00 Saúl Ibarra Corretgé <[email protected]>: >> I'd also like to support Trollius. I guess using yield From(fut) >> would do, right? But how does one get around the syntax error on >> Python < 3.3, if at all possible? > > You can use the callback API which is the same in Tulip and > Trollius: > http://trollius.readthedocs.org/#write-code-working-on-trollius-and-tulip > > TBH I wasn't sure which way to go: return the future and let the caller deal with it, it do what I did. Perhaps I should return the future and then it will work for both.
> Or you have to duplicate some parts of your code and use "if python > < 3.3: ... else: ...". It may be possible to do that in the same > file using exec(), which is ugly. Or using two different Python > files and import. > Maybe I can create a helper function "yield_from" a la six.reraise using exec where appropriate. It's ugly, yes, I'll give it a shot and see how it goes. >>> http://code.google.com/p/tulip/issues/detail?id=160 >> >> There is a small problem with that. For the most part, what >> people need is getaddrinfo, which c-ares doesn't have, so I'd >> have to 'emulate' it by running it on a thread. The problem is >> that the parameters that were used to configure the Ares channel >> (nameservers, timeout, ... [0]) wouldn't apply to getaddrinfo. > > I implemented getaddrinfo() using pycares without threads: > https://bitbucket.org/haypo/asyncio_staging/src/tip/resolver_cares.py > > It's not well tested, I'm not sure that I pass the right flags. > Maybe it can indeed be emulated indeed, I haven't looked into that yet. > pycares is used to resolve IPv4 and IPv6 addresses. For other > families, the code falls back to socket.getaddrinfo() called in > the executor (asyncio default implementation). Maybe an exception > could be raised instead? > I'd raise NotImplementedError if the family is not AF_INET/6 or AF_UNSPEC (in the latter case we'd do 2 lookups). >> http://daniel.haxx.se/blog/2012/01/03/getaddrinfo-with-round-robin-dns-and-happy-eyeballs/ > >> > For the happy eyeball, asyncio API must be modified because > create_connection() currently "blocks" until getaddrinfo() returns > all IPv4 and all IPv6 addresses. There is an issue but no > implementation yet: > http://code.google.com/p/tulip/issues/detail?id=86 > Good to know! - -- Saúl Ibarra Corretgé bettercallsaghul.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iQIcBAEBAgAGBQJTNAbcAAoJEEEOVVOum8BZy7MQAJaPqnArbdQD+b6jKbAauueO t842XUuh0Db/TYaDd2U8bVOxQS3ZhjoabRDGwhnALRkQ39dbemMtdo6FQY2RIMQM sIa0IASuMwkJgUEcK9/TN4Cj+dzfg55UzIjapQB7emdYWqUi1/Etij33aG+U1vO+ uYRlEGFhhTgXNKhNVwlKW9yIxNXJAWSxE/TVBiHt/2PD33zdArj7Wxf5f9MlVUil r693e+Cv8c4I755ESPluOckvVB848IDBu9LJNsLb74JmjzKzLxZhE5udh+oTYjIL 6efxSGjrOlayjAKYOCFiUNfxD6YN8jyGQcEIKYWncTMwGNT4970d1Io8W8z47gVn KUrV+VIIuluT5dbYXkpvWIL05MNxQOBYYr7l4cMuHRqIAkJHGdVZoxt2J0nCWcn6 R/UchugmCDBJfUxrbMgwcCUysy2lvrIj+9eV8OSmHJJsYVXmSiICX4SYT0WZaUg3 zUeOSmVEE+xFwyFbZ8F2VobAhvfAm2Z9vDi+XaEYVBSiF5n47TtYMuHxFbigC7Iq E5vfq9tU7Y3+LRS84oZezbo4Rw7oro0iC6eAico4K1yX3t6AmEk7PuUFKN6Xz464 azLMWrF6kRGwEacTsWho5pD8Txrox4T1bWtq88c3VAv/PlHTiEj6QiZhRlCZAaW8 my2SBadacqwX6oVCfkHx =jf1Q -----END PGP SIGNATURE-----
