From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: rehan malak Newsgroups: gmane.emacs.bugs Subject: bug#74738: 31.0.50; Freezes in Python-mode on some Python file when searching or scrolling Date: Sun, 8 Dec 2024 14:05:36 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f308ff0628c1e1b6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15308"; mail-complaints-to="usenet@ciao.gmane.io" To: 74738@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 08 16:01:26 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 1tKImk-0003nm-2W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Dec 2024 16:01:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKImW-0006ZH-4T; Sun, 08 Dec 2024 10:01:15 -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 1tKImN-0006Yr-0D for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 10:01:08 -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 1tKImM-0007OW-OH for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 10:01:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=G2sIsTZFehvl/4crpyGcbdxxJ9krPBKlCTxOM3RzpVE=; b=s3vEtaL8YCVjB8H14iCaMXXXFr8IB8o5h8TF0u3R5hIzdK9mvHjm/e4kpvYhz80MiXLMqQTEz2sJT9sFrCthEtEmfJubB+jBdvxh7Kdg7WRNsmZEShEtd7HUVSUsE2hwJPpPX6PNPQC3wurAmYMsFK1kapjBX5lfCPIzGJEp1CWoKJovJXQv2Kic7jvlMDZhexhQO+C0RZnaQwEC5qd7aO8stlbBFj/KlzOqlwIBsdgnzNgx7rCq5tX/IozyBxpas3oz7XYXlpYYDD3apsX/rhBYID0jCBdlpzK6K/zfWkYVyTpmfvmTSS1nHLdmrvVLz8PLAMw5zKY/ZRdmGwEL5g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKImM-00064K-EF for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 10:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: rehan malak Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74738 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173367000722874 (code B ref -1); Sun, 08 Dec 2024 15:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Dec 2024 15:00:07 +0000 Original-Received: from localhost ([127.0.0.1]:51369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKIlQ-0005ve-Ei for submit@debbugs.gnu.org; Sun, 08 Dec 2024 10:00:07 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKGzN-0008Rx-Tc for submit@debbugs.gnu.org; Sun, 08 Dec 2024 08:06:23 -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 1tKGxF-0007o6-S9 for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 08:04:11 -0500 Original-Received: from mail-vk1-xa2f.google.com ([2607:f8b0:4864:20::a2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKGxD-0002wR-8c for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2024 08:04:09 -0500 Original-Received: by mail-vk1-xa2f.google.com with SMTP id 71dfb90a1353d-5160f1870f3so385862e0c.0 for ; Sun, 08 Dec 2024 05:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733663045; x=1734267845; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=G2sIsTZFehvl/4crpyGcbdxxJ9krPBKlCTxOM3RzpVE=; b=cRUsyagGJgR0ZWxBrMXe1bwJM7gfweIsvmQdtM0eoKVrf3qDBY+CDVP6H4iqYBMLHO auJ2PkGsWYe8gwfxqvNPX320sP/0dTRMD3O70rgTvt9wia6nrkMUJ6zrWYP4wxU86S43 nSdrxiOL83tVPQZxK9Bmqoe+uw2ybtnA4pc6F/VxnCX1YdwTSLlDnzx4WQ2NYcWx+FkE LpsmveNPs/S63Uq8W+ovlpsGy4VQG9M9x9gJeSACc2WfxPUkRVaVD324yK0ivqf4S2xb aK1q7HJmqHq4WHaubDyodLo/YTiO+oCbcU7LpsLFOZ2WkP5yKZT38sepLk9Brgk6BN0G fqLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733663045; x=1734267845; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=G2sIsTZFehvl/4crpyGcbdxxJ9krPBKlCTxOM3RzpVE=; b=AvxNlc6gtOSJWJcOnBvQU2dAJj84Xd+ad/3Cn1YZE6RFPjtPPr6QJta9l3dzNV8Par Hq/16g25l4ZOCDkkL5rYBFxwH+Fswc9DhS1QGuOZW6KLhpZtCl/CYEkujgCuB1LrmdC+ 2B52VXy7D/D1VojQbr5/AITLGv6lijTFj7338U3iYlsZ4A+b0ZGXQD+2D6ajItErdP4C 1LAuj+0hsUe0h/AvrLgD4TMXeyp0tJMZ8Xlre5qDV4v9hYB1FE1LI856JO0+J4kjuW13 UKot3Bs0aCJp8xvvZzS8XyJ9HirVrFYPse6aXnsjstCNyv+DuzDkYFZgLcN3bOeC+k9y +FFw== X-Gm-Message-State: AOJu0YwV+Gr+2/qmopWsEBMvdfWIT/lO1x5PJAO9viRt3dABxZff3uKh g8nIMBZCsnyrDDN9hmfGdKPwo7U7pdfLnFZT5TsLoSRcdHwzE3hJobu+r4o2mSOoTCyndKOOcX+ Km9oGAgRojo3Qjc7ZNg9gcD57BjNEavWn X-Gm-Gg: ASbGnctSLHZp56F+jDPgSDZ4zKhw7ixEgjqsfggAPXdTqa7OGv5AH+WKQ+N0qGe0dBf q+6kM9P9LgdlbBT6PVKvY0P/eX0WPWdgx X-Google-Smtp-Source: AGHT+IFQqvyrjZxv5CvdhZeTPdJL6yayeZhrpC6zGfXF+1maYVnEOzErf9IU9Za91zJoDw10g2f9u1D09hArNs8R2rc= X-Received: by 2002:a05:6122:c81:b0:515:3bfb:d421 with SMTP id 71dfb90a1353d-515fca3498amr8011815e0c.6.1733663044861; Sun, 08 Dec 2024 05:04:04 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::a2f; envelope-from=rehan.malak@gmail.com; helo=mail-vk1-xa2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 08 Dec 2024 10:00:02 -0500 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:296640 Archived-At: --000000000000f308ff0628c1e1b6 Content-Type: text/plain; charset="UTF-8" Hi, 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 PageDown several times or scrolling with the mouse Emacs freezes, Ctrl-g not working, CPU 100% It works also by searching : Ctrl-s show RET then Ctrl-s several times With a minimal .emacs : (set debug-on-error t) (set debug-on-quit t) and before scrolling M-x profiler-start RET then in an external terminal pkill -SIGUSR2 emacs I get the backtrace : Debugger entered--entering a function: * #f(compiled-function () #)() syntax-ppss() python-syntax-context-type() python-nav-forward-block(-1) python-nav-backward-block() python-nav-beginning-of-block() python-nav-end-of-block() python-info-statement-ends-block-p() python-info-end-of-block-p() python-nav--forward-sexp(1 nil nil) python-nav-forward-sexp(1) forward-sexp(1) up-list(1) python--font-lock-f-strings(30419) font-lock-fontify-keywords-region(28914 30419 nil) font-lock-default-fontify-region(28914 30414 nil) font-lock-fontify-region(28914 30414) #f(compiled-function (fun) #)(font-lock-fontify-region) run-hook-wrapped(#f(compiled-function (fun) #) font-lock-fontify-region) jit-lock--run-functions(28914 30414) jit-lock-fontify-now(28914 30414) jit-lock-function(28914) and can look at profiler report M-x profiler-stop M-x profiler-report showing time spent in syntax-ppss 17770 88% - jit-lock-function 17770 88% - jit-lock-fontify-now 17770 88% - jit-lock--run-functions 17770 88% - run-hook-wrapped 17770 88% - # 17770 88% - font-lock-fontify-region 17770 88% - font-lock-default-fontify-region 17690 87% - font-lock-fontify-keywords-region 17678 87% - python--font-lock-f-strings 17674 87% - up-list 17674 87% - forward-sexp 17674 87% - python-nav-forward-sexp 17674 87% - python-nav--forward-sexp 9253 45% - python-info-end-of-block-p 9245 45% - python-info-statement-ends-block-p 9221 45% - python-nav-end-of-block 8609 42% - python-nav-beginning-of-block 8557 42% - python-nav-backward-block 8557 42% - python-nav-forward-block 8005 39% - python-syntax-context-type 7997 39% - syntax-ppss 7097 35% parse-partial-sexp 753 3% + # 376 1% + python-nav-beginning-of-statement 132 0% re-search-backward 24 0% looking-at 28 0% current-indentation 8 0% + python-nav-beginning-of-statement 4 0% python-info-current-line-empty-p 4 0% + python-info-current-line-comment-p 604 2% + python-nav-end-of-statement 4 0% + python-info-current-line-comment-p 4 0% current-indentation 24 0% + python-nav-end-of-statement 8 0% + python-info-end-of-statement-p 8178 40% - python-info-statement-ends-block-p 8150 40% - python-nav-end-of-block 7754 38% - python-nav-beginning-of-block 7738 38% - python-nav-backward-block 7734 38% - python-nav-forward-block 7178 35% - python-syntax-context-type 7174 35% - syntax-ppss 6978 34% parse-partial-sexp 8 0% make-closure 8 0% # 4 0% syntax-table 4 0% syntax-ppss--update-stats 412 2% + python-nav-beginning-of-statement 92 0% re-search-backward 44 0% looking-at 12 0% current-indentation 4 0% looking-at 380 1% + python-nav-end-of-statement 16 0% + python-util-forward-comment 28 0% + python-nav-end-of-statement 151 0% + python-nav-end-of-block 28 0% + python-info-beginning-of-block-p 24 0% + python-info-end-of-statement-p 20 0% + python-info-beginning-of-statement-p 8 0% + python-syntax-context-type 8 0% + python-info-statement-starts-block-p 4 0% + syntax-ppss 8 0% + # 4 0% + # 80 0% + font-lock-fontify-syntactically-region 2279 11% Automatic GC 73 0% + redisplay_internal (C function) 40 0% + command-execute 8 0% + ... 4 0% + mouse--click-1-maybe-follows-link other people talking about python/profiling/syntax-ppss : https://www.reddit.com/r/emacs/comments/z0oye9/emacs_freezes_when_opening_a_python_file/ https://www.reddit.com/r/emacs/comments/9h7onq/large_python_files_hanging_with_an_unmatched_quote/ Please tell me how I can help ? Please tell me if there is a workaround without losing python syntax color ? Thanks Rehan In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2024-12-08 built on cndl Repository revision: b953bcb17047998c9e41cede7c5e5ffec22209b2 Repository branch: master System Description: Debian GNU/Linux trixie/sid Configured using: 'configure --prefix=/home/jean/local/emacs --with-pgtk' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PGTK PNG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-seq python rx project byte-opt gv bytecomp byte-compile compat pcase treesit comint subr-x ansi-osc ring cl-loaddefs cl-lib ansi-color rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo gtk pgtk multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 60995 13527) (symbols 48 7517 0) (strings 32 19122 1493) (string-bytes 1 515162) (vectors 16 13554) (vector-slots 8 145472 8433) (floats 8 26 2) (intervals 56 436 0) (buffers 984 12)) --000000000000f308ff0628c1e1b6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
I can reproduce systematically this freeze dealing = with a 10000lines
Python file :

wget https://raw.githubuserco= ntent.com/hugsy/gef/refs/heads/main/gef.py
emacs -Q gef.py

Pa= geDown several times or scrolling with the mouse

Emacs freezes, Ctrl= -g not working, CPU 100%

It works also by searching : Ctrl-s show RE= T
then Ctrl-s several times




With a minimal .emacs :
(set debug-on-error t)
(set debug-on-quit t)

and before s= crolling

M-x profiler-start RET

then in an external terminal<= br>
pkill -SIGUSR2 emacs

I get the backtrace :

Debugger en= tered--entering a function:
* #f(compiled-function () #<bytecode -0x1= 79dcd1db31182ae>)()
=C2=A0 syntax-ppss()
=C2=A0 python-syntax-cont= ext-type()
=C2=A0 python-nav-forward-block(-1)
=C2=A0 python-nav-back= ward-block()
=C2=A0 python-nav-beginning-of-block()
=C2=A0 python-nav= -end-of-block()
=C2=A0 python-info-statement-ends-block-p()
=C2=A0 py= thon-info-end-of-block-p()
=C2=A0 python-nav--forward-sexp(1 nil nil)=C2=A0 python-nav-forward-sexp(1)
=C2=A0 forward-sexp(1)
=C2=A0 up-l= ist(1)
=C2=A0 python--font-lock-f-strings(30419)
=C2=A0 font-lock-fon= tify-keywords-region(28914 30419 nil)
=C2=A0 font-lock-default-fontify-r= egion(28914 30414 nil)
=C2=A0 font-lock-fontify-region(28914 30414)
= =C2=A0 #f(compiled-function (fun) #<bytecode -0x8a96d65e1315e71>)(fon= t-lock-fontify-region)
=C2=A0 run-hook-wrapped(#f(compiled-function (fun= ) #<bytecode -0x8a96d65e1315e71>) font-lock-fontify-region)
=C2=A0= jit-lock--run-functions(28914 30414)
=C2=A0 jit-lock-fontify-now(28914 = 30414)
=C2=A0 jit-lock-function(28914)

and can look at profiler r= eport

M-x profiler-stop
M-x profiler-report

showing time s= pent in syntax-ppss


=C2=A0 =C2=A0 =C2=A0 =C2=A017770 =C2=A088% -= jit-lock-function
=C2=A0 =C2=A0 =C2=A0 =C2=A017770 =C2=A088% =C2=A0- ji= t-lock-fontify-now
=C2=A0 =C2=A0 =C2=A0 =C2=A017770 =C2=A088% =C2=A0 - j= it-lock--run-functions
=C2=A0 =C2=A0 =C2=A0 =C2=A017770 =C2=A088% =C2=A0= =C2=A0- run-hook-wrapped
=C2=A0 =C2=A0 =C2=A0 =C2=A017770 =C2=A088% =C2= =A0 =C2=A0 - #<byte-code-function FA0>
=C2=A0 =C2=A0 =C2=A0 =C2=A0= 17770 =C2=A088% =C2=A0 =C2=A0 =C2=A0- font-lock-fontify-region
=C2=A0 = =C2=A0 =C2=A0 =C2=A017770 =C2=A088% =C2=A0 =C2=A0 =C2=A0 - font-lock-defaul= t-fontify-region
=C2=A0 =C2=A0 =C2=A0 =C2=A017690 =C2=A087% =C2=A0 =C2= =A0 =C2=A0 =C2=A0- font-lock-fontify-keywords-region
=C2=A0 =C2=A0 =C2= =A0 =C2=A017678 =C2=A087% =C2=A0 =C2=A0 =C2=A0 =C2=A0 - python--font-lock-f= -strings
=C2=A0 =C2=A0 =C2=A0 =C2=A017674 =C2=A087% =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0- up-list
=C2=A0 =C2=A0 =C2=A0 =C2=A017674 =C2=A087% =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - forward-sexp
=C2=A0 =C2=A0 =C2=A0 =C2= =A017674 =C2=A087% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- python-nav-fo= rward-sexp
=C2=A0 =C2=A0 =C2=A0 =C2=A017674 =C2=A087% =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 - python-nav--forward-sexp
=C2=A0 =C2=A0 =C2=A0= =C2=A0 9253 =C2=A045% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- py= thon-info-end-of-block-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 9245 =C2=A045% =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - python-info-statement-ends-= block-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 9221 =C2=A045% =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- python-nav-end-of-block
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 8609 =C2=A042% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 - python-nav-beginning-of-block
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 8557 =C2=A042% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0- python-nav-backward-block
=C2=A0 =C2=A0 =C2=A0 =C2=A0 8557 =C2= =A042% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - pyt= hon-nav-forward-block
=C2=A0 =C2=A0 =C2=A0 =C2=A0 8005 =C2=A039% =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- python-synt= ax-context-type
=C2=A0 =C2=A0 =C2=A0 =C2=A0 7997 =C2=A039% =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - syntax-ppss
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 7097 =C2=A035% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parse-partial-sexp
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0753 =C2=A0 3% =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ #<byte-code-function = A23>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0376 =C2=A0 1% =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-nav-beginni= ng-of-statement
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0132 =C2=A0 0% =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0re-sea= rch-backward
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 24 =C2=A0 0% =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0looking-a= t
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 28 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0current-indentation
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-nav-beginning-of-statement=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-info-current-line-e= mpty-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-info-current-l= ine-comment-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0604 =C2=A0 2% =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 + python-nav-end-of-statement=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 + python-info-current-line-comment-p=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 current-indentation
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 24 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0+ python-nav-end-of-statement
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 + python-info-end-of-statement-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = 8178 =C2=A040% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- python-inf= o-statement-ends-block-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 8150 =C2=A040% =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - python-nav-end-of-block
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 7754 =C2=A038% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0- python-nav-beginning-of-block
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 7738 =C2=A038% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 - python-nav-backward-block
=C2=A0 =C2=A0 =C2=A0 =C2=A0 7734 = =C2=A038% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- p= ython-nav-forward-block
=C2=A0 =C2=A0 =C2=A0 =C2=A0 7178 =C2=A035% =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - python-syntax= -context-type
=C2=A0 =C2=A0 =C2=A0 =C2=A0 7174 =C2=A035% =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- syntax-ppss
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 6978 =C2=A034% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 parse-partial-sexp
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 make-closure
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #<byte-code-function B1E>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 syntax-table
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 syntax-ppss--update= -stats
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0412 =C2=A0 2% =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 + python-nav-beginning-of-sta= tement
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 92 =C2=A0 0% =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 re-search-backward
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 44 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 looking-at
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 12 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 current-indentation
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 looking-at
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0380 =C2=A0 1% = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-nav-end-of-= statement
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 16 =C2=A0 0% =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-util-forward-comment
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 28 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 + python-nav-end-of-statement
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0151 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0+ python-nav-end-of-block
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 28 =C2= =A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-info-beginn= ing-of-block-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 24 =C2=A0 0% =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ python-info-end-of-statement-p=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 20 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0+ python-info-beginning-of-statement-p
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0+ python-syntax-context-type
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0+ python-info-statement-starts-block-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ syntax-ppss=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0= =C2=A0 + #<byte-code-function 7E0>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A04 =C2=A0 0% =C2=A0 =C2=A0 =C2=A0 =C2=A0 + #<byte-code-funct= ion 740>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 80 =C2=A0 0% =C2=A0 =C2= =A0 =C2=A0 =C2=A0+ font-lock-fontify-syntactically-region
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 2279 =C2=A011% =C2=A0 Automatic GC
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 73 =C2=A0 0% + redisplay_internal (C function)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 40 =C2=A0 0% + command-execute
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A08 =C2=A0 0% + ...
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A04 =C2=A0 0% + mouse--click-1-maybe-follows-link

other = people talking about python/profiling/syntax-ppss :

https://www.reddit.com/r/emacs/comments/z0oye9/emacs_freezes_when= _opening_a_python_file/
https://= www.reddit.com/r/emacs/comments/9h7onq/large_python_files_hanging_with_an_u= nmatched_quote/

Please tell me how I can help ?

Please te= ll me if there is a workaround without losing python syntax color ?

= Thanks

Rehan



In GNU Emacs 31.0.50 (build 1, x86_64-pc= -linux-gnu, GTK+ Version
=C2=A03.24.43, cairo version 1.18.2) of 2024-12= -08 built on cndl
Repository revision: b953bcb17047998c9e41cede7c5e5ffec= 22209b2
Repository branch: master
System Description: Debian GNU/Linu= x trixie/sid

Configured using:
=C2=A0'configure --prefix=3D/h= ome/jean/local/emacs --with-pgtk'

Configured features:
CAIRO = DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBXML2= MODULES NOTIFY INOTIFY PDUMPER PGTK PNG SECCOMP SOUND THREADS
TIFF TOOL= KIT_SCROLL_BARS WEBP XIM GTK3 ZLIB

Important settings:
=C2=A0 val= ue of $LANG: en_US.UTF-8
=C2=A0 value of $XMODIFIERS: @im=3Dibus
=C2= =A0 locale-coding-system: utf-8-unix

Major mode: Python

Minor= modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t<= br>=C2=A0 eldoc-mode: t
=C2=A0 show-paren-mode: t
=C2=A0 electric-ind= ent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-fo= nt-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t<= br>=C2=A0 minibuffer-regexp-mode: t
=C2=A0 line-number-mode: t
=C2=A0= transient-mark-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-e= ncryption-mode: t
=C2=A0 auto-compression-mode: t

Load-path shado= ws:
None found.

Features:
(shadow sort mail-extr emacsbug mess= age mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec pass= word-cache epa derived epg rfc6068
epg-config gnus-util text-property-se= arch time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbr= ev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail= -prsvr mail-utils cl-seq python
rx project byte-opt gv bytecomp byte-com= pile compat pcase treesit comint
subr-x ansi-osc ring cl-loaddefs cl-lib= ansi-color rmc iso-transl
tooltip cconv eldoc paren electric uniquify e= diff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-= win term/common-win
touch-screen pgtk-dnd tool-bar dnd fontset image reg= exp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode pro= g-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer= select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-co= lors
frame minibuffer nadvice seq simple cl-generic indonesian philippin= e
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet la= o
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czecheuropean ethiopic indian cyrillic chinese composite emoji-zwj charscriptcharprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosurecl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
fi= les window text-properties overlay sha1 md5 base64 format env
code-pages= mule custom widget keymap hashtable-print-readable backquote
threads db= usbind inotify dynamic-setting system-font-setting
font-render-setting c= airo gtk pgtk multi-tty move-toolbar
make-network-process emacs)

= Memory information:
((conses 16 60995 13527) (symbols 48 7517 0) (string= s 32 19122 1493)
=C2=A0(string-bytes 1 515162) (vectors 16 13554)
=C2= =A0(vector-slots 8 145472 8433) (floats 8 26 2) (intervals 56 436 0)
=C2= =A0(buffers 984 12))
--000000000000f308ff0628c1e1b6--