From 4666ec597c38eea06a22bcfb4157d92a0abf891c Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Fri, 26 Jan 2018 10:53:31 +0900 Subject: bpo-32596: Make lazy-load portable (GH-5316) Global variables should not used as import target. Use temporary variable instead. --- Lib/concurrent/futures/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/concurrent/futures/__init__.py b/Lib/concurrent/futures/__init__.py index 72aca81..8434fcf 100644 --- a/Lib/concurrent/futures/__init__.py +++ b/Lib/concurrent/futures/__init__.py @@ -40,11 +40,13 @@ def __getattr__(name): global ProcessPoolExecutor, ThreadPoolExecutor if name == 'ProcessPoolExecutor': - from .process import ProcessPoolExecutor - return ProcessPoolExecutor + from .process import ProcessPoolExecutor as pe + ProcessPoolExecutor = pe + return pe if name == 'ThreadPoolExecutor': - from .thread import ThreadPoolExecutor - return ThreadPoolExecutor + from .thread import ThreadPoolExecutor as te + ThreadPoolExecutor = te + return te raise AttributeError(f"module {__name__} has no attribute {name}") -- cgit v0.12