X Tutup
Skip to content

Commit 2df245b

Browse files
committed
Use builtins module
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 1b4cc8f commit 2df245b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import threading
1616
import time
1717
import unicodedata
18-
from six.moves import range
18+
from six.moves import range, builtins
1919

2020
from pygments import format
2121
from bpython._py3compat import PythonLexer
@@ -416,7 +416,7 @@ def __enter__(self):
416416
signal.signal(signal.SIGWINCH, self.sigwinch_handler)
417417
signal.signal(signal.SIGTSTP, self.sigtstp_handler)
418418

419-
self.orig_import = __builtins__['__import__']
419+
self.orig_import = builtins.__import__
420420
if self.watcher:
421421
# for reading modules if they fail to load
422422
old_module_locations = {}
@@ -438,7 +438,7 @@ def new_import(name, globals={}, locals={}, fromlist=[],
438438
old_module_locations[name] = m.__file__
439439
self.watcher.track_module(m.__file__)
440440
return m
441-
__builtins__['__import__'] = new_import
441+
builtins.__import__ = new_import
442442

443443
sitefix.monkeypatch_quit()
444444
return self
@@ -449,7 +449,7 @@ def __exit__(self, *args):
449449
sys.stderr = self.orig_stderr
450450
signal.signal(signal.SIGWINCH, self.orig_sigwinch_handler)
451451
signal.signal(signal.SIGTSTP, self.orig_sigtstp_handler)
452-
__builtins__['__import__'] = self.orig_import
452+
builtins.__import__ = self.orig_import
453453

454454
def sigwinch_handler(self, signum, frame):
455455
old_rows, old_columns = self.height, self.width

0 commit comments

Comments
 (0)
X Tutup