]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-114763: Protect lazy loading modules from attribute access races (GH-114781...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 26 Feb 2024 20:50:55 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 20:50:55 +0000 (20:50 +0000)
commit46f821d62b5a1599890419aa963d7353619942b6
treefff43824ef8a9c6f19871f7fa80a2c47ce32af31
parenta30a1e7a4968f393d598ec5b2b96fa9ef42438be
[3.11] gh-114763: Protect lazy loading modules from attribute access races (GH-114781) (GH-115871)

gh-114763: Protect lazy loading modules from attribute access races (GH-114781)

Setting the __class__ attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
(cherry picked from commit 200271c61db44d90759f8a8934949aefd72d5724)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Lib/importlib/util.py
Lib/test/test_importlib/test_lazy.py
Misc/NEWS.d/next/Library/2024-01-30-23-28-29.gh-issue-114763.BRjKkg.rst [new file with mode: 0644]