SIGN IN SIGN UP

gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740)

This fixes a race during import. The existing _PyRuntimeState.imports.pkgcontext is shared between interpreters, and occasionally this would cause a crash when multiple interpreters were importing extensions modules at the same time.  To solve this we add a thread-local variable for the value.  We also leave the existing state (and infrequent race) in place for platforms that do not support thread-local variables.
E
Eric Snow committed
b87d2882754a7c273e2695c33384383eba380d7d
Parent: fcf0647
Committed by GitHub <noreply@github.com> on 6/14/2023, 12:58:23 AM