]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-124218: Avoid refcount contention on builtins module (GH-125847)
authorSam Gross <colesbury@gmail.com>
Thu, 24 Oct 2024 16:44:38 +0000 (12:44 -0400)
committerGitHub <noreply@github.com>
Thu, 24 Oct 2024 16:44:38 +0000 (12:44 -0400)
commit3c4a7fa6178d852ccb73527aaa2d0a5e93022e89
treee74c8d15c6dab8e3b58478aa5e0d9915477f83de
parent5003ad5c5ea508f0dde1b374cd8bc6a481ad5c5d
gh-124218: Avoid refcount contention on builtins module (GH-125847)

This replaces `_PyEval_BuiltinsFromGlobals` with
`_PyDict_LoadBuiltinsFromGlobals`, which returns a new reference
instead of a borrowed reference. Internally, the new function uses
per-thread reference counting when possible to avoid contention on the
refcount fields on the builtins module.
Include/internal/pycore_ceval.h
Include/internal/pycore_dict.h
Objects/dictobject.c
Objects/frameobject.c
Objects/funcobject.c
Python/ceval.c