Thinking about it, I think this call stack injection must be the way calling from C to python works. How else could it work? The GIL could be obtained anytime, and Python isn’t going to start a new interpreter per call, so it’s got to just run in the current context.
Also I don’t think this is a bug in Django - the client has disconnected so there’s no way to write anything back - pulling the DB plug immediately makes some sense.
So how to save other folks spending ages trying to figure out what’s going wrong when this happens? Some documentation would be nice. I’ll raise a request.