From b1788e495f98ebc1c9185f40deccdf466efae69f 2012-09-11 10:36:02 From: Thomas Kluyver Date: 2012-09-11 10:36:02 Subject: [PATCH] Make IndentationErrors display like other SyntaxErrors Closes gh-2398 --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 8c1ab31..f6bb427 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -1716,7 +1716,7 @@ class InteractiveShell(SingletonConfigurable): self.write_err('No traceback available to show.\n') return - if etype is SyntaxError: + if issubclass(etype, SyntaxError): # Though this won't be called by syntax errors in the input # line, there may be SyntaxError cases with imported code. self.showsyntaxerror(filename) @@ -1769,7 +1769,7 @@ class InteractiveShell(SingletonConfigurable): """ etype, value, last_traceback = self._get_exc_info() - if filename and etype is SyntaxError: + if filename and issubclass(etype, SyntaxError): try: value.filename = filename except: diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index 881cab9..991734f 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -552,7 +552,7 @@ class ListTB(TBTools): # Not sure if this can still happen in Python 2.6 and above list.append( py3compat.cast_unicode(stype) + '\n') else: - if etype is SyntaxError: + if issubclass(etype, SyntaxError): have_filedata = True #print 'filename is',filename # dbg if not value.filename: value.filename = ""