* lisp/progmodes/python.el
(python-info-dedenter-opening-block-positions): Check that the
supposed block start is not a method call (bug#62031).
* test/lisp/progmodes/python-tests.el (python-indent-after-re-match):
New test.
Co-authored-by: Lele Gaifax <lele@metapensiero.it>
(catch 'exit
(while (python-nav--syntactically
(lambda ()
- (re-search-backward (python-rx block-start) nil t))
+ (cl-loop for pt = (re-search-backward (python-rx block-start) nil t)
+ until (memq (char-before) '(nil ?\s ?\t ?\n))
+ finally return pt))
#'<)
(let ((indentation (current-indentation)))
(when (and (not (memq indentation collected-indentations))
(should (eq (car (python-indent-context)) :after-block-start))
(should (= (python-indent-calculate-indentation) 8))))
+(ert-deftest python-indent-after-re-match ()
+ "Test BUG 62031 regression."
+ (python-tests-with-temp-buffer
+ "
+def test_re(string):
+ if re.match('^[a-c]+$', string):
+ print('yes')
+ else:
+ "
+ (python-tests-look-at "else:")
+ (should (= (python-indent-calculate-indentation) 4))))
+
\f
;;; Filling