Message389713
Unless I've misread or misunderstood, the documentation at https://docs.python.org/3/reference/import.html#loaders for the deprecated `load_module` method doesn't indicate any requirements or caveats for thread safe importing. As it stands, I think it is not thread-safe, since the module is not protected against concurrent imports by the internal implementation marker `__spec__._initializing = True`.
Additionally, the deprecated function decorator, `importlib.util.module_for_loader` seems to implement the marker incorrectly (sets `__initializing__` directly on the module).
I think this behaviour should either be documented as a major caveat, or internal details exposed to allow thread-safe implementations, or the old API removed entirely. |
|
Date |
User |
Action |
Args |
2021-03-29 16:53:01 | kale-smoothie | set | recipients:
+ kale-smoothie, docs@python |
2021-03-29 16:53:01 | kale-smoothie | set | messageid: <1617036781.07.0.980162704543.issue43658@roundup.psfhosted.org> |
2021-03-29 16:53:01 | kale-smoothie | link | issue43658 messages |
2021-03-29 16:53:00 | kale-smoothie | create | |
|