]> granicus.if.org Git - python/commitdiff
bpo-32596: Make lazy-load portable (GH-5316)
authorINADA Naoki <methane@users.noreply.github.com>
Fri, 26 Jan 2018 01:53:31 +0000 (10:53 +0900)
committerGitHub <noreply@github.com>
Fri, 26 Jan 2018 01:53:31 +0000 (10:53 +0900)
Global variables should not used as import target.
Use temporary variable instead.

Lib/concurrent/futures/__init__.py

index 72aca818d3ef00efea0ac2e448225ccd1d4e88c3..8434fcf4b5ead4b4109a9e75c189dc63e70ad15a 100644 (file)
@@ -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}")