LWN: Comments on "Varrazzo: Thinking psycopg3" https://lwn.net/Articles/814822/ This is a special feed containing comments posted to the individual LWN article titled "Varrazzo: Thinking psycopg3". en-us Fri, 03 Oct 2025 07:22:11 +0000 Fri, 03 Oct 2025 07:22:11 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Varrazzo: Thinking psycopg3 https://lwn.net/Articles/838517/ https://lwn.net/Articles/838517/ malefic <div class="FormattedComment"> It really is very simple. Python async functions are just generators, which you can &quot;call&quot; or &quot;iterate&quot; over manually. The key part in blocking_proto.pyx is _iter_coroutine, which is basically all you need to &quot;call&quot; an async function. You don&#x27;t need an event loop or anything. It&#x27;s the non-blocking I/O part that `yield`-s to the event loop that makes the code async, once all your sockets are blocking it basically becomes regular blocking code with a weird calling convention.<br> </div> Mon, 30 Nov 2020 05:08:36 +0000 Seriously? https://lwn.net/Articles/815171/ https://lwn.net/Articles/815171/ Wol <div class="FormattedComment"> Is it just that he doesn't suffer fools gladly?<br> <p> And it's very noticeable in society generally that as people age they get more cantankerous. I just shrug and say to myself "I hope I don't get like that as I get older".<br> <p> Cheers,<br> Wol<br> </div> Tue, 17 Mar 2020 12:18:39 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/815029/ https://lwn.net/Articles/815029/ auc <div class="FormattedComment"> Looking at blocking_proto.pyx, I'm a bit suprised you need something so small. In the asyncpg source, async/await is all over the place (incl. cython parts). I just don't understand what you're doing there.<br> </div> Mon, 16 Mar 2020 11:10:36 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/815028/ https://lwn.net/Articles/815028/ auc <div class="FormattedComment"> Yes of course, I did my own loop-per-thread management. Still fails in obscure ways I hadn't the immediate time budget for.<br> </div> Mon, 16 Mar 2020 11:05:27 +0000 Seriously? https://lwn.net/Articles/815023/ https://lwn.net/Articles/815023/ ballombe <div class="FormattedComment"> I do not know. Language has been toned down but the attacks have gone more vicious.<br> </div> Mon, 16 Mar 2020 10:21:14 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814945/ https://lwn.net/Articles/814945/ malefic <div class="FormattedComment"> asyncio is not thread safe, you must use a separate event loop in each thread and never call loop or task methods from another thread (with the exception of the explicit loop.call_soon_threadsafe()).<br> </div> Sat, 14 Mar 2020 20:13:01 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814931/ https://lwn.net/Articles/814931/ auc <div class="FormattedComment"> I disagree with your choice of words but honestly I am very disappointed with the way Python has been managed by the core devs ... for the past ten years. We basically had two forks: Python 3 and Asyncio. The later is a fork within the language itself. I guess this probably happened because Python around 2.5 was basically a done thing, and what's more funny than breaking things ?<br> </div> Sat, 14 Mar 2020 17:22:19 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814930/ https://lwn.net/Articles/814930/ auc <div class="FormattedComment"> I attempted the sync-facade in front of the async loop. It works until you start doing threads. Then it breaks down in the most obscure ways. In all fairness I only invested like, three full days into this, but the experiment was not too encouraging. Asyncio is such a big mess :/<br> <p> Still I'll have a look at what you've done, thanks for the link :)<br> </div> Sat, 14 Mar 2020 17:11:43 +0000 Seriously? https://lwn.net/Articles/814921/ https://lwn.net/Articles/814921/ corbet Do note that the comment you linked to is from 2012... The archives are full of stuff from that source that is not matched by what he posts today. I can actually understand those who feel that we have lost something, he has a way with words that few can match. But we are stronger as a community if we are not constantly attacking each other. Sat, 14 Mar 2020 16:05:02 +0000 Seriously? https://lwn.net/Articles/814920/ https://lwn.net/Articles/814920/ HelloWorld <div class="FormattedComment"> Yeah… I guess it's OK when Al Viro does it though. <br> <p> <a rel="nofollow" href="https://lwn.net/Articles/513188/">https://lwn.net/Articles/513188/</a><br> </div> Sat, 14 Mar 2020 16:01:26 +0000 Seriously? https://lwn.net/Articles/814918/ https://lwn.net/Articles/814918/ corbet Come on now. If you think that async could be better handled in Python, well that's fair game (though a bit off-topic on this article). But calling the work of people who have worked their ass off and given the results away a "turd" really is not. Why are you so attached to kindergarten-level insults? <p> This account has been the source of rather too many issues like these; moderation bit is now on. Sat, 14 Mar 2020 15:26:23 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814894/ https://lwn.net/Articles/814894/ jrigg <div class="FormattedComment"> <font class="QuotedText">&gt; I'm glad I don't need to work with that turd a lot.</font><br> <p> There seems to be a lot of this around here lately. I don't like Python much, but I just use something else without feeling the need to trash the work of others.<br> <p> <p> </div> Sat, 14 Mar 2020 10:57:58 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814868/ https://lwn.net/Articles/814868/ malefic <div class="FormattedComment"> It is entirely possible to have an async-first driver with a small synchronous facade on top. See the edgedb-python driver [1] for how it can be done. Unfortunately, we made a mistake of relying on futures too much in asyncpg. It will need to be refactored to use coroutines instead before this approach can be applied. I'll be happy to help with reviews and guidance if you're willing to take this on!<br> <p> [1] <a href="https://github.com/edgedb/edgedb-python/blob/master/edgedb/protocol/blocking_proto.pyx">https://github.com/edgedb/edgedb-python/blob/master/edged...</a><br> </div> Sat, 14 Mar 2020 01:59:01 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814871/ https://lwn.net/Articles/814871/ HelloWorld <div class="FormattedComment"> It's pretty pathetic that in the Python world you still need to worry about whether something is async or not. Every time I read about Python I'm glad I don't need to work with that turd a lot.<br> </div> Sat, 14 Mar 2020 00:09:55 +0000 Varrazzo: Thinking psycopg3 https://lwn.net/Articles/814838/ https://lwn.net/Articles/814838/ auc <div class="FormattedComment"> Don't miss asyncpg (<a href="https://github.com/MagicStack/asyncpg">https://github.com/MagicStack/asyncpg</a>) which is an awesome python/postgresql driver. My only regret is that it is tied to the async monad, which makes it basically useless within the non-async world. Maybe this year I will do an attempt at a non-async variant of this ...<br> </div> Fri, 13 Mar 2020 17:25:21 +0000