Skip to content

Commit 4666ec5

Browse files
authored
bpo-32596: Make lazy-load portable (GH-5316)
Global variables should not used as import target. Use temporary variable instead.
1 parent 2fc98ae commit 4666ec5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/concurrent/futures/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ def __getattr__(name):
4040
global ProcessPoolExecutor, ThreadPoolExecutor
4141

4242
if name == 'ProcessPoolExecutor':
43-
from .process import ProcessPoolExecutor
44-
return ProcessPoolExecutor
43+
from .process import ProcessPoolExecutor as pe
44+
ProcessPoolExecutor = pe
45+
return pe
4546

4647
if name == 'ThreadPoolExecutor':
47-
from .thread import ThreadPoolExecutor
48-
return ThreadPoolExecutor
48+
from .thread import ThreadPoolExecutor as te
49+
ThreadPoolExecutor = te
50+
return te
4951

5052
raise AttributeError(f"module {__name__} has no attribute {name}")

0 commit comments

Comments
 (0)