@@ -215,16 +215,6 @@ def __init__(self):
215
215
# Create and initialize ipython, but don't start its mainloop
216
216
IP = InteractiveShell .instance (config = config , profile_dir = profile )
217
217
218
- self_closure = self
219
-
220
- def custom_handler (self , etype , value , tb , tb_offset = None ):
221
- if not self_closure .suppress_exception_warning :
222
- errstr = ("WARNING: Exception in statement '%s', %s, %s)\n "
223
- % (self_closure .datacontent [1 ], etype , value ))
224
- sys .stderr .write (errstr )
225
-
226
- IP .set_custom_exc ((Exception ,), custom_handler )
227
-
228
218
# io.stdout redirect must be done *after* instantiating InteractiveShell
229
219
io .stdout = self .cout
230
220
io .stderr = self .cout
@@ -315,11 +305,6 @@ def process_input(self, data, input_prompt, lineno):
315
305
316
306
input_lines = input .split ('\n ' )
317
307
318
- if is_okexcept :
319
- self .suppress_exception_warning = True
320
- else :
321
- self .suppress_exception_warning = False
322
-
323
308
self .datacontent = data
324
309
325
310
continuation = ' %s:' % '' .join (['.' ]* (len (str (lineno ))+ 2 ))
@@ -369,6 +354,9 @@ def process_input(self, data, input_prompt, lineno):
369
354
if not is_suppress and not is_semicolon :
370
355
ret .append (output )
371
356
357
+ if not is_okexcept and "Traceback" in output :
358
+ sys .stdout .write (output )
359
+
372
360
self .cout .truncate (0 )
373
361
return (ret , input_lines , output , is_doctest , image_file ,
374
362
image_directive )
0 commit comments