diff options
author | Sam Gross <colesbury@gmail.com> | 2024-05-07 00:12:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 00:12:39 (GMT) |
commit | 723d4d2fe8e77b398f0ccffcfa541149caaac6a1 (patch) | |
tree | 8d213981ac3bc060c5046acdc256015d2c821476 /Python/pylifecycle.c | |
parent | 8d8275b0cf43f0e20c72a9641cbddc5044cdae04 (diff) | |
download | cpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.zip cpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.tar.gz cpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.tar.bz2 |
gh-118527: Intern code consts in free-threaded build (#118667)
We already intern and immortalize most string constants. In the
free-threaded build, other constants can be a source of reference count
contention because they are shared by all threads running the same code
objects.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index f24b048..67bbbd0 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -854,6 +854,11 @@ pycore_interp_init(PyThreadState *tstate) return status; } + status = _PyCode_Init(interp); + if (_PyStatus_EXCEPTION(status)) { + return status; + } + status = _PyDtoa_Init(interp); if (_PyStatus_EXCEPTION(status)) { return status; @@ -1827,6 +1832,8 @@ finalize_interp_types(PyInterpreterState *interp) _PyTypes_Fini(interp); + _PyCode_Fini(interp); + // Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses // a dict internally. _PyUnicode_ClearInterned(interp); |