File tree Expand file tree Collapse file tree 1 file changed +16
-19
lines changed
Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def monkeypatch_quit():
2121 if 'site' in sys .modules :
2222 resetquit (builtins )
2323
24+
2425orig_reload = None
2526if py3 :
2627 import importlib
@@ -31,27 +32,23 @@ def monkeypatch_quit():
3132else :
3233 orig_reload = builtins .reload
3334
34- if orig_reload :
35- def reload (module ):
36- if module is sys :
37- orig_stdout = sys .stdout
38- orig_stderr = sys .stderr
39- orig_stdin = sys .stdin
40- r = orig_reload (sys )
41- sys .stdout = orig_stdout
42- sys .stderr = orig_stderr
43- sys .stdin = orig_stdin
44- return r
45- else :
46- return orig_reload (module )
4735
48- functools .update_wrapper (reload , orig_reload )
36+ def reload (module ):
37+ if module is sys :
38+ orig_stdout = sys .stdout
39+ orig_stderr = sys .stderr
40+ orig_stdin = sys .stdin
41+ r = orig_reload (sys )
42+ sys .stdout = orig_stdout
43+ sys .stderr = orig_stderr
44+ sys .stdin = orig_stdin
45+ return r
46+ else :
47+ return orig_reload (module )
48+
49+ functools .update_wrapper (reload , orig_reload )
4950
5051
5152def monkeypatch_reload ():
52- if py3 and hasattr (importlib , 'reload' ):
53- importlib .reload = reload
54- elif py3 and hasattr (imp , 'reload' ):
55- imp .reload = reload
56- else :
53+ if not py3 :
5754 builtins .reload = reload
You can’t perform that action at this time.
0 commit comments