Request for review of "gh-117983: Defer import of threading for lazy module loading"

Hi all. I contributed a patch to importlib.util in gh-114763: Protect lazy loading modules from attribute access race by effigies · Pull Request #114781 · python/cpython · GitHub, which added a lock to prevent a race condition when lazily loading modules. Following advice, I imported threading at the module level. This turned out to break gevent (GH-114781 potentially breaks gevent: threading becomes pre-imported at startup · Issue #117983 · python/cpython · GitHub).

After a somewhat inconclusive discussion at that issue, I went ahead and submitted a patch that’s been open for 3 weeks:

I believe that the PR is worth it, and include benchmarking data to back it up, but I would mostly like an up/down decision.

1 Like

Once I’m done working through my discuss.python.org backlog this PR is in my review queue.

1 Like