Skip to content

Commit 43e7038

Browse files
committed
Use correct default level values (fixes #486)
Python 2 uses -1, Python 3 uses 0. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 33dae4f commit 43e7038

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,11 @@ def __enter__(self):
420420
if self.watcher:
421421
# for reading modules if they fail to load
422422
old_module_locations = {}
423+
default_level = 0 if py3 else -1
423424

424425
@functools.wraps(self.orig_import)
425-
def new_import(name, globals={}, locals={}, fromlist=[], level=-1):
426+
def new_import(name, globals={}, locals={}, fromlist=[],
427+
level=default_level):
426428
try:
427429
m = self.orig_import(name, globals=globals, locals=locals,
428430
fromlist=fromlist, level=level)

0 commit comments

Comments
 (0)