From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#74738: 31.0.50; Freezes in Python-mode on some Python file when searching or scrolling Date: Tue, 10 Dec 2024 00:04:28 +0900 Message-ID: References: <868qsqf54x.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8427"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 74738@debbugs.gnu.org, Stefan Monnier To: rehan malak , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 09 16:06:35 2024 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 1tKfLG-0001xq-NX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Dec 2024 16:06:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKfKo-0003pY-FF; Mon, 09 Dec 2024 10:06:06 -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 1tKfKk-0003om-QU for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 10:06:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKfKk-0001uK-Hy for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 10:06:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=ylLCLpIeIl7K/gJSRy2pBPLhBxm3MZWs4tnh8Q6GXLg=; b=YK5b54P70SJOOiW8tM13zdeOqraOf67pgKemYNdTcPdqew3jCW6OQ3teikddIC7l45NDrFwY960gciY1BaejdWdtbLP4Jd0whDgVRi1yHzuj0RT2qcKtg/nyxMcz5XMCAO+fiiZ1GLe8MmGDBitrvNSp83ZArEAh9+OgGgGTCYNu5cZmOg+fKIgaVhc3BKHFIe7W7cCmPnctmqUzhnYpAqWUdDD+YFu+hkHEoo6UA+/ulxTbN1N71e3+jMMYermtR/7KiQxEtgu+R8C+WAMo+P01wPALYkcw8+2XyV22xvfy20dUnEgDkuhSQZy/fAApcGWOpLgTf6PI/4F8afpfQQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKfKk-0001ft-AJ for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2024 10:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Dec 2024 15:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74738 X-GNU-PR-Package: emacs Original-Received: via spool by 74738-submit@debbugs.gnu.org id=B74738.17337567556422 (code B ref 74738); Mon, 09 Dec 2024 15:06:02 +0000 Original-Received: (at 74738) by debbugs.gnu.org; 9 Dec 2024 15:05:55 +0000 Original-Received: from localhost ([127.0.0.1]:55149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKfKc-0001fV-Ui for submit@debbugs.gnu.org; Mon, 09 Dec 2024 10:05:55 -0500 Original-Received: from mail-pl1-f174.google.com ([209.85.214.174]:48437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKfKa-0001f0-KF for 74738@debbugs.gnu.org; Mon, 09 Dec 2024 10:05:53 -0500 Original-Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-21644e6140cso12250385ad.1 for <74738@debbugs.gnu.org>; Mon, 09 Dec 2024 07:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733756686; x=1734361486; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=ylLCLpIeIl7K/gJSRy2pBPLhBxm3MZWs4tnh8Q6GXLg=; b=cI41bIxK78xik2n+kj/SQ3byzJz9yFyLXnaNedjVZiCNUywzHTa5NcvHYWBatne92n loyNRA55mPTcvMVaNGcK8iGpgkpUB1/F9zP9cUOivfo5mVgJED2N/LcWvC8BIlQ2CZHZ DV6VidBhBdy1vsiEOv9BEaQ3U+3SUDg19dTHRGhVVXbK1K/a2AA5BQtAFaAGznLXab7m Q7Xcx3RLTvLIHM6Cqqk5ZrjEbgxar8q+VKsw1IphmLqan7vXsaDE8nFSArPSVnVHeBUl rbtVYp8L07P6WS67ZtvXKZzSJ9qSZgJrb315wELYaDSXt3rh4n2HkdRbmOj2DF/i5rTx utWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733756686; x=1734361486; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ylLCLpIeIl7K/gJSRy2pBPLhBxm3MZWs4tnh8Q6GXLg=; b=IRytVQedtCv3EO6UIaaJ0WUHZoFKOwp5i6yF9NI0dXlhnh5zsD7N6Rj1CBF0tn74hv YOtTzq2YiWLvfIiFdm2AUTjXb9o2+4bcHw0tpUJoAPMYISTyIHkX1cFsQJclosovwGSI PTY/osv7uN+jtP90YZK0K+b53VesokEBmVoEgqvT8fE/bZtIJHG3Tll1Xc/s3ZuKf2ed pheL73+v/RkGAYKIh27zdmRY3RQI1HltY+jqPKkyzS2y1j72zdWhBn30HV8KSSrKcbfx Hy8yQN0yN7oI4/tK742t2fV4zI/rU18czGmlhfpkRq78EZoKDFAI6lS5YB1q4n7MQs/U SZlA== X-Forwarded-Encrypted: i=1; AJvYcCX87KggpdTCTd9uHH+EV3IuVwjngcC9/2Up3LFNilwlW29AhAn8nBtMjAFchwYXp44+2udZhA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzOwFnoTh6x1J82CCa0REN5vYv3ZCCqUoBdHchIm2RF97tm6a7t hKCKciqQuaRUarMrX5ujPkAyFgfhG567B/zgr1PGmm0OiQvjG2jU X-Gm-Gg: ASbGnct0JUOiEwKc8AlYSv+vXorvCeIUOYzA07go6RVDY/Bjv8vBETO92eZoIvZy2Ly 5FDtXVXsjCPzBY9B8ueZZx10lqN1xDzP0iZKCJOY+X775Z2LUyWXGUSou/TPoZmrYYWEi+i2xJX 4Z3FFFb7qUrVfuIV912EuiLcWNxcMXztyKdJFiSvhPzsB2SETPUWxp8nJiLP2KjbmSKcqXXkhTs ma8ZuPsQCN8tkUVY2Hn+Z6+2q8oIJQ/oUxbsS3lzZR7aSpVFatWLhcKi4dy1FV6erzl1TFNVjh9 iKYD X-Google-Smtp-Source: AGHT+IF+sDDWBmCeWx00vW+3QDMLLn/8RFcKy9tPb+O6b1E1ER7JDOE4HorP3FZMjeOH9nrjFPAhUA== X-Received: by 2002:a17:902:ea07:b0:212:996:353a with SMTP id d9443c01a7336-21669fc936amr13071945ad.12.1733756686355; Mon, 09 Dec 2024 07:04:46 -0800 (PST) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21615dba950sm57051845ad.11.2024.12.09.07.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 07:04:45 -0800 (PST) In-Reply-To: <868qsqf54x.fsf@gnu.org> 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:296697 Archived-At: rehan malak wrote: > Please tell me if there is a workaround without losing python syntax color ? If you can configure Emacs to use tree-sitter, python-ts-mode would not be affected by this problem. Eli Zaretskii wrote: > > > From: rehan malak > > Date: Sun, 8 Dec 2024 14:05:36 +0100 > > > > I can reproduce systematically this freeze dealing with a 10000lines > > Python file : > > > > wget https://raw.githubusercontent.com/hugsy/gef/refs/heads/main/gef.py > > emacs -Q gef.py It seems to be reproducible after the following commit: commit 3b3274a85c2f5df21d76d82e0d7740005aa84fdf Author: Stefan Monnier Date: Fri Oct 16 14:03:59 2020 -0400 * lisp/progmodes/python.el: Teach f-strings to `font-lock` (python--f-string-p, python--font-lock-f-strings): New functions. (python-font-lock-keywords-maximum-decoration): Use them. > A much smaller reproducer is attached below. Just visiting it freezes > Emacs. But if I change the line marked below: > > @classmethod > def is_valid(cls, _: pathlib.Path) -> bool: > raise NotImplementedError > > def __str__(self) -> str: > >>>>> return f"{self.name}('{self.path.absolute()}', entry @ {self.entry_point:#x})" > > to say this instead: > > return self.name > > the problem goes away. So it is something in that complex expression > that trips syntax-ppss. > > Stefan and kobarity, any suggestions or ideas? I could not reproduce the freeze, but it took several seconds to visit the reproducer. It appears to be possible to work around this by simply removing the format specifier ":#x". return f"{self.name}('{self.path.absolute()}', entry @ {self.entry_point})" So there may be a problem with font-lock when there is an f-string format specifier, but I have not found the root cause yet.