bpo-44717: refactor _PyModuleSpec helpers by FFY00 · Pull Request #27344 · python/cpython
This PR refactors _PyModuleSpec_IsInitializing, as suggested in #26822, and adds the exception cleaning side effect to _PyModuleSpec_IsUninitializedSubmodule. The exception cleaning is not really needed in _PyModuleSpec_IsUninitializedSubmodule as we are using it, but it makes the code too fragile, so I think it would be best to align it with _PyModuleSpec_IsInitializing, this was an oversight of the initial implementation. Btw, sorry for all of the back and forward on this bpo 😕