On 2018-09-12, Neil Schemenauer wrote:
Personally, I think the correct way to do it is to pass ctx as the first parameter to all C-API functions. If it is not a global, I think you have to pass it. Other schemes are suboptimal and we should do the correct thing.
After talking to Dino a bit, I'm not sure about this now. It sounds like you could use thread-local storage rather than globals. That would be somewhat more limited but would still, in theory, allow what I was hoping for. The bigger issue seems to be allowing a per-interpreter GIL. Eric Snow is working on this with the multi-core (no GIL-sharing) project and it sounds like he thinks API changes should not be needed.
If my understanding is true, that's great news. The prospect of having to pass ctx everywhere inside CPython internals is quite frightening.