From 29228e24f20954b93dccef4ac5d704ca31daa80c Mon Sep 17 00:00:00 2001
From: Dmitry Gutov <dgutov@yandex.ru>
Date: Thu, 9 Mar 2023 17:24:54 +0200
Subject: python-info-dedenter-opening-block-positions: Fix to support "bare"
 match

* lisp/progmodes/python.el
(python-info-dedenter-opening-block-positions): Make the check
stricter.  Require that block starts only at indentation.

* test/lisp/progmodes/python-tests.el
(python-indent-after-bare-match): Another test (bug#62031).
---
 test/lisp/progmodes/python-tests.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'test/lisp/progmodes/python-tests.el')

diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 7e2f66e9095..2568299bb66 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1994,6 +1994,20 @@ def test_re(string):
    (python-tests-look-at "else:")
    (should (= (python-indent-calculate-indentation) 4))))
 
+(ert-deftest python-indent-after-bare-match ()
+  "Test BUG 62031 regression."
+  (python-tests-with-temp-buffer
+   "
+from re import match
+
+def test_re(string):
+    if match('^[a-c]+$', string):
+        print('yes')
+    else:
+    "
+   (python-tests-look-at "else:")
+   (should (= (python-indent-calculate-indentation) 4))))
+
 
 ;;; Filling
 
-- 
cgit v1.2.3