◐ Shell
clean mode source ↗

gh-110415: move datetime global state into module state by costasgambit · Pull Request #110420 · python/cpython

I'm closing this, since it's not finished yet and is a duplicate.

The test failures in question are due to a global (and rather bad-smelling) capsule object that I hadn't gotten round to yet.

If dealing with that would involve a C api change then some process will be required.

However, arguably with a bit of effort the capsule could be made to work if used from the main interpreter only and throw if one attempts to re-import it from elsewhere. That way that particular C api will stay the same for legacy extensions that rely on it, but the datetime module itself can become sub-interpreter compatible.