gh-126316: Use mutexes in the grp module by vstinner · Pull Request #126504 · python/cpython
Yeah, but a subinterpreter can have its own GIL, so if these functions aren't thread safe on a system level, then it won't be thread safe across multiple interpreters. I think we just need to add a Py_mod_multiple_interpreters module slot with Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED, to indicate that subinterpreters need to use a shared GIL to use the module.