Subject: bug#75729: [PATCH] python-mode: add `exit` to the list of block-enders

From: Konstantin Kharlamov <[email-masked]>
Date: Tue, 21 Jan 2025 18:41:54 +0300

`exit()` ends current codeflow, there can't be any code past it. So
account `exit` similarly to `return`, `continue`, etc.

From 7806987dd88b2507d97255c2e6ca989e791c798b Mon Sep 17 00:00:00 2001
From: Konstantin Kharlamov <[email-masked]>
Date: Tue, 21 Jan 2025 18:34:54 +0300
Subject: [PATCH] python-mode: add `exit` to the list of block-enders

`exit()` ends current codeflow, there can't be any code past it. So
account `exit` similarly to `return`, `continue`, etc.

* /lisp/progmodes/python.el (python-rx): add `exit` to the list of
block-enders.
---
 lisp/progmodes/python.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 16c296a8f86..2feb9f47e1a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -442,7 +442,8 @@ python-rx
                                     symbol-end))
             (block-ender       (seq symbol-start
                                     (or
-                                     "break" "continue" "pass" "raise" "return")
+                                     "break" "continue" "pass" "raise" "return"
+                                     "exit")
                                     symbol-end))
             (decorator         (seq line-start (* space) ?@ (any letter ?_)
                                     (* (any word ?_))))
-- 
2.48.1