Skip to content

Commit 2deadfe

Browse files
fix reload in Python 3
1 parent 5619544 commit 2deadfe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

bpython/curtsiesfrontend/sitefix.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from six.moves import builtins
55

6+
from bpython import py3
7+
68

79
def resetquit(builtins):
810
"""Redefine builtins 'quit' and 'exit' not so close stdin
@@ -18,8 +20,11 @@ def monkeypatch_quit():
1820
if 'site' in sys.modules:
1921
resetquit(builtins)
2022

21-
22-
orig_reload = builtins.reload
23+
if py3:
24+
import importlib
25+
orig_reload = importlib.reload
26+
else:
27+
orig_reload = builtins.reload
2328

2429

2530
def reload(module):
@@ -39,4 +44,7 @@ def reload(module):
3944

4045

4146
def monkeypatch_reload():
42-
builtins.reload = reload
47+
if py3:
48+
importlib.reload = reload
49+
else:
50+
builtins.reload = reload

0 commit comments

Comments
 (0)