From 57aefd02b7129972ad480e375d0e43fc56a96444 2013-10-03 04:26:26 From: MinRK <benjaminrk@gmail.com> Date: 2013-10-03 04:26:26 Subject: [PATCH] adjust default value of level in sync_imports and value check for <= 0 instead of just -1. Python 3 no longer allows negative values (relative or absolute), and we should have always allowed 0 to work anyway. closes #4296 --- diff --git a/IPython/parallel/client/view.py b/IPython/parallel/client/view.py index 809b1ed..7bd4326 100644 --- a/IPython/parallel/client/view.py +++ b/IPython/parallel/client/view.py @@ -457,7 +457,7 @@ class DirectView(View): else: user_ns[name] = sys.modules[name] - def view_import(name, globals={}, locals={}, fromlist=[], level=-1): + def view_import(name, globals={}, locals={}, fromlist=[], level=0): """the drop-in replacement for __import__, that optionally imports locally as well. """ @@ -478,7 +478,7 @@ class DirectView(View): imp.release_lock() key = name+':'+','.join(fromlist or []) - if level == -1 and key not in modules: + if level <= 0 and key not in modules: modules.add(key) if not quiet: if fromlist: