From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lele Gaifax Newsgroups: gmane.emacs.bugs Subject: bug#62031: 29.0.60; python-mode indentation after re.match Date: Wed, 08 Mar 2023 08:53:19 +0100 Message-ID: <87wn3rk7bk.fsf@metapensiero.it> References: <5ea3a37a-4e43-4ede-9f96-7159f54272e8@yandex.ru> <87bkl4y5gw.fsf@metapensiero.it> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35962"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Rob Moss , Dmitry Gutov To: 62031@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 08 08:54:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZocx-00096I-PV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Mar 2023 08:54:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZocf-0001DM-46; Wed, 08 Mar 2023 02:54:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZocd-0001D3-CA for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 02:54:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZocd-0004fq-3r for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 02:54:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pZocd-0000vF-0F for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 02:54:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lele Gaifax Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Mar 2023 07:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62031 X-GNU-PR-Package: emacs Original-Received: via spool by 62031-submit@debbugs.gnu.org id=B62031.16782620063477 (code B ref 62031); Wed, 08 Mar 2023 07:54:02 +0000 Original-Received: (at 62031) by debbugs.gnu.org; 8 Mar 2023 07:53:26 +0000 Original-Received: from localhost ([127.0.0.1]:47700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZoc1-0000tw-Vk for submit@debbugs.gnu.org; Wed, 08 Mar 2023 02:53:26 -0500 Original-Received: from orphu.arstecnica.it ([178.63.97.204]:58244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZobz-0000tk-HW for 62031@debbugs.gnu.org; Wed, 08 Mar 2023 02:53:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metapensiero.it; s=mail; t=1678262001; bh=B3JoQtmuIQ3fPKKK87drWG27RTruRtNIndCc3lfiTrk=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=NU/ZIz0LAMeZPXJepwAvnf5jRgnOLT2PitsuMVXkMf6G469hyUO34qp0b6j8x6pSu stZLc+ncsUdbgo6MhCM6My8kf8SCVyk9EC80LjJg+dXSAP8VOx41TN7UUr5az8M7rz YGyf5ccI79DA/5eiPLO01dDJHpCUUmbx2LpVhAwc= In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257517 Archived-At: I had a quick glance at this, and while I can confirm the problem with the following test diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 4f24c042c6a..9926c4b002f 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1982,6 +1982,17 @@ python-virt-bin (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)))) I could not figure out how this can be fixed, with my current knowledge on python.el. There are several places where the regexp produced by `(python-rx block-start)' is used, many within a `(looking-at ...)' form and several others in a `(re-search-forward ...)': given that block starting "keywords" are required to be at the beginning of a line, possibly preceded by whitespace, I think that the problem may arise from those usages which do not explicitly enforce the constraint, but unfortunately all my attempts to do that a) didn't make the test above green and b) broke one or more of the other tests. I will try again, but I'm afraid this will go beyond my current spare time availability. bye, lele.