exception raised in a wxPython application terminates the process only when debugging under PyCharm

This is a copy of a question I posted to StackExchange:

Under wxPython when an unhandled exception arises in the main loop the traceback is printed and the exception is ignored.
Not so when debugging under PyCharm.
Then the unhandled exception leads to termination of the process.
Also, this is new behavior as previous versions of PyCharm did not behave this way.

Take the following test code:

import wx
import wx.lib.sized_controls as sc

def Raise(evt=None):
    raise Exception('error')

app = wx.App()
frame = sc.SizedFrame(None,-1,'hello')
p = frame.GetContentsPane()
b = wx.Button(p,-1,'press')
frame.Bind(wx.EVT_BUTTON,Raise,b)
frame.Show()
app.MainLoop()

Pressing the button when running this normally results in an exception printed and ignored. When running this under PyCharm debug mode the process terminates. Is there a way to change this behavior?

Windows10, Python3.6, wxPython 4.0.4, PyCharm 2019.3

Please sign in to leave a comment.