diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-01-26 01:53:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 01:53:31 (GMT) |
commit | 4666ec597c38eea06a22bcfb4157d92a0abf891c (patch) | |
tree | 85a0b544af160f4b1147a08ddf297d29be052e15 /Lib/concurrent | |
parent | 2fc98ae115e2a2095a0bcf388c27a878aafdb454 (diff) | |
download | cpython-4666ec597c38eea06a22bcfb4157d92a0abf891c.zip cpython-4666ec597c38eea06a22bcfb4157d92a0abf891c.tar.gz cpython-4666ec597c38eea06a22bcfb4157d92a0abf891c.tar.bz2 |
bpo-32596: Make lazy-load portable (GH-5316)
Global variables should not used as import target.
Use temporary variable instead.
Diffstat (limited to 'Lib/concurrent')
-rw-r--r-- | Lib/concurrent/futures/__init__.py | 10 |
1 files 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}") |