]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740)
authorEric Snow <ericsnowcurrently@gmail.com>
Wed, 14 Jun 2023 00:58:23 +0000 (18:58 -0600)
committerGitHub <noreply@github.com>
Wed, 14 Jun 2023 00:58:23 +0000 (18:58 -0600)
commitb87d2882754a7c273e2695c33384383eba380d7d
tree55718e32fdacacf3dc3be2c8e6d00d02b9df193f
parentfcf0647cf2a78de2c2b603af2709d58c8567df67
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.
Python/import.c
Tools/c-analyzer/c_parser/parser/_regexes.py
Tools/c-analyzer/c_parser/preprocessor/gcc.py
Tools/c-analyzer/cpython/ignored.tsv