Skip to content


Fix for %tb magic. #1396

merged 1 commit into from

2 participants

IPython member

In order for the %tb magic to work as expected, no other error can be raised by invoking it. Even if an error is caught immediately, it affects the 'last error' values in sys.

This cuts a try/except block out of ip.magic(). Happily, in this case there was a simpler way to do the same thing.

@minrk minrk merged commit 920beab into ipython:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 9, 2012
  1. @takluyver

    Fix for %tb magic.

    takluyver committed
Showing with 1 addition and 6 deletions.
  1. +1 −6 IPython/core/
7 IPython/core/
@@ -1971,14 +1971,9 @@ def magic(self, arg_s, next_input=None):
if next_input:
- args = arg_s.split(' ',1)
- magic_name = args[0]
+ magic_name, _, magic_args = arg_s.partition(' ')
magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
- try:
- magic_args = args[1]
- except IndexError:
- magic_args = ''
fn = getattr(self,'magic_'+magic_name,None)
if fn is None:
error("Magic function `%s` not found." % magic_name)
Something went wrong with that request. Please try again.