Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support relative import in "%run -m"

  • Loading branch information...
commit 41039016e97c1a1297215c277625ca9b3f494893 1 parent f97338d
@tkf authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 IPython/core/magics/execution.py
View
20 IPython/core/magics/execution.py
@@ -593,14 +593,18 @@ def run(self, parameter_s='', runner=None,
# user (run by exec in pdb itself).
self.shell.InteractiveTB(etype, value, tb, tb_offset=3)
else:
- if runner is None:
- runner = self.default_runner
- if runner is None:
- runner = self.shell.safe_execfile
-
- def run():
- runner(filename, prog_ns, prog_ns,
- exit_ignore=exit_ignore)
+ if 'm' in opts:
+ def run():
+ self.shell.safe_run_module(modulename, prog_ns)
+ else:
+ if runner is None:
+ runner = self.default_runner
+ if runner is None:
+ runner = self.shell.safe_execfile
+
+ def run():
+ runner(filename, prog_ns, prog_ns,
+ exit_ignore=exit_ignore)
if 't' in opts:
# timed execution
Please sign in to comment.
Something went wrong with that request. Please try again.