Unverified Kaydet (Commit) 4666ec59 authored tarafından INADA Naoki's avatar INADA Naoki Kaydeden (comit) GitHub

bpo-32596: Make lazy-load portable (GH-5316)

Global variables should not used as import target.
Use temporary variable instead.
üst 2fc98ae1
...@@ -40,11 +40,13 @@ def __getattr__(name): ...@@ -40,11 +40,13 @@ def __getattr__(name):
global ProcessPoolExecutor, ThreadPoolExecutor global ProcessPoolExecutor, ThreadPoolExecutor
if name == 'ProcessPoolExecutor': if name == 'ProcessPoolExecutor':
from .process import ProcessPoolExecutor from .process import ProcessPoolExecutor as pe
return ProcessPoolExecutor ProcessPoolExecutor = pe
return pe
if name == 'ThreadPoolExecutor': if name == 'ThreadPoolExecutor':
from .thread import ThreadPoolExecutor from .thread import ThreadPoolExecutor as te
return ThreadPoolExecutor ThreadPoolExecutor = te
return te
raise AttributeError(f"module {__name__} has no attribute {name}") raise AttributeError(f"module {__name__} has no attribute {name}")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment