Author Aaron.Meurer
Recipients Aaron.Meurer
Date 2017-05-17.04:03:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494993815.34.0.567809017687.issue30384@psf.upfronthosting.co.za>
In-reply-to
Content
I'm trying to completely hide an exception from the traceback module. From reading the source, it looks like the only way to do this is to set __traceback__ to None (I can also set __suppress_context__ to True, but that only works if I have another exception higher up in the context chain). 

However, this still prints the traceback itself, and the line for SyntaxErrors. Consider the attached test.py. It outputs

ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    raise TypeError
TypeError

  File "<string>", line 1
    a b
      ^
SyntaxError: unexpected EOF while parsing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    raise TypeError
TypeError

I suppose it should also not print the "During handling of the above exception, another exception occurred:" part.
History
Date User Action Args
2017-05-17 04:03:35Aaron.Meurersetrecipients: + Aaron.Meurer
2017-05-17 04:03:35Aaron.Meurersetmessageid: <1494993815.34.0.567809017687.issue30384@psf.upfronthosting.co.za>
2017-05-17 04:03:35Aaron.Meurerlinkissue30384 messages
2017-05-17 04:03:34Aaron.Meurercreate