* 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).
(while (python-nav--syntactically
(lambda ()
(cl-loop while (re-search-backward (python-rx block-start) nil t)
- if (memq (char-before) '(nil ?\s ?\t ?\n))
+ if (save-match-data
+ (looking-back (rx line-start (* whitespace))
+ (line-beginning-position)))
return t))
#'<)
(let ((indentation (current-indentation)))
(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))))
+
\f
;;; Filling