From: INADA Naoki Date: Fri, 26 Jan 2018 01:53:31 +0000 (+0900) Subject: bpo-32596: Make lazy-load portable (GH-5316) X-Git-Tag: v3.7.0b1~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4666ec597c38eea06a22bcfb4157d92a0abf891c;p=thirdparty%2FPython%2Fcpython.git bpo-32596: Make lazy-load portable (GH-5316) Global variables should not used as import target. Use temporary variable instead. --- diff --git a/Lib/concurrent/futures/__init__.py b/Lib/concurrent/futures/__init__.py index 72aca818d3ef..8434fcf4b5ea 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}")