diff --git a/src/flask/app.py b/src/flask/app.py index e0c193dcb7..9f5656655c 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -1568,8 +1568,10 @@ def wsgi_app( except Exception as e: error = e response = self.handle_exception(ctx, e) - except: # noqa: B001 - error = sys.exc_info()[1] + except BaseException as e: + # Catch BaseException (KeyboardInterrupt, SystemExit, etc.) + # that should not be handled by the exception handler + error = e raise return response(environ, start_response) finally: