Skip to content

Commit 87470ef

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> (cherry picked from commit 43e7038)
1 parent 25edf54 commit 87470ef

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
@@ -419,9 +419,11 @@ def __enter__(self):
419419
if self.watcher:
420420
# for reading modules if they fail to load
421421
old_module_locations = {}
422+
default_level = 0 if py3 else -1
422423

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

0 commit comments

Comments
 (0)