]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] 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:43:44 +0000 (21:43 +0100)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 20:43:44 +0000 (20:43 +0000)
commit7b91b9001a444f5b5acdfd786b07bfde3405e93a
treeccb8d89d0e70bcea76c8eb9bf902245bee2ce4c2
parent53b84e772cac6e4a55cebf908d6bb9c48fe254dc
[3.12] gh-114763: Protect lazy loading modules from attribute access races (GH-114781) (GH-115870)

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]