]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-114763: Protect lazy loading modules from attribute access races (GH-114781)
authorChris Markiewicz <effigies@gmail.com>
Sat, 24 Feb 2024 00:02:16 +0000 (19:02 -0500)
committerGitHub <noreply@github.com>
Sat, 24 Feb 2024 00:02:16 +0000 (16:02 -0800)
commit200271c61db44d90759f8a8934949aefd72d5724
tree9fddf73bc8d17f6d71c8ac26591911c98a445a9c
parentef6074b352a95706f44a592ffe31baace690cc1c
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.
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]