Subject: bug#63363: closed (Re: bug#63363: 28.2; emacs freezes opening python file w/ unclosed quotes)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 11 May 2023 05:44:02 +0000

Your bug report

#63363: 28.2; emacs freezes opening python file w/ unclosed quotes

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
63363: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63363
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#63363: 28.2; emacs freezes opening python file w/ unclosed quotes
From: Eli Zaretskii <[email-masked]>
To: James Mazer <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 11 May 2023 08:44:54 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: James Mazer <[email-masked]>
> Date: Wed, 10 May 2023 17:01:02 -0600
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> Just confirmed that with an emacs 29.0.90 snap (beta) I'm not seeing the lock up. So it appears to be
> fixed downstream, but would be nice to be able to fix in 28 until 29 is actually released :-)

Thanks for testing in Emacs 29.  I'm therefore closing this bug.

Subject: 28.2; emacs freezes opening python file w/ unclosed quotes
From: James Mazer <[email-masked]>
To: [email-masked]
Date: Sun, 7 May 2023 19:02:24 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

Emacs 28.2 (and I think 28.1 at least) locks up when opening file
containing unclosed triple quotes in a docstring (ie, docstring started,
but not yet closed) in vanilla python mode.

To replicate, save the following to a file, say `foo.py`
-------cut here-------
def Foo:
    # comment out next line and works ok, incomplete comment -> locks up
    """
    pass

class Bar:
    labelmasks: torch.Tensor
    """blah blah blah - single line common ok, >1 line locks up
    """

class Baz:
    def __init__(self):
"""apostrophe in this quote causes lock up. It's better to..."""
pass
-------end cut-------

And then just run `emacs -Q foo.py`. Under X11, window appears and is
completely frozen, must be killed from another window. Same happens
if you open file with `find-file` etc. Seems to be something related to
trying to fontify the buffer in python-mode.

This also happens periodically when typing into a buffer if you create an
unclosed docstring. I can't reliably replicate that conditions, but appears
to be the same problem. Can also see this issue on  github where it was
originally posted (thinking it was an issue with the linux snap
distribution): https://github.com/alexmurray/emacs-snap/issues/44. This
does not appear to be related to the snap distribution and github issue
indicates that this also occurs in emacs-29.

Sending SIGUSR2 generates the following backtrace:
> Debugger entered--entering a function:
> * #f(compiled-function () #<bytecode 0xb8840b003fb641a>)()
>   font-lock-fontify-syntactically-region(1 347 nil)
>   font-lock-default-fontify-region(1 347 nil)
>   font-lock-fontify-region(1 347)
>   #f(compiled-function (fun) #<bytecode
0x19ba0d15e0d0b9bd>)(font-lock-fontify-region)
>   jit-lock--run-functions(1 347)
>   jit-lock-fontify-now(1 1501)
>   jit-lock-function(1)
>   redisplay_internal\ \(C\ function\)()

In GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0)
 of 2023-04-26 built on lcy02-amd64-043
Repository revision: 34c90cc5f22e16b027a731d10c3f58f9e44101e9
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Linux Mint 20.2

Configured using:
 'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
 --without-xaw3d --with-modules --with-cairo --with-native-compilation
 'CFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
 -O2' 'CPPFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu'
 'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
 -L/build/emacs/parts/emacs/install/usr/lib
 -L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
 -L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-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 cl-generic
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 simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 68541 8782)
 (symbols 48 6639 0)
 (strings 32 19479 2438)
 (string-bytes 1 666720)
 (vectors 16 14703)
 (vector-slots 8 301741 11225)
 (floats 8 22 32)
 (intervals 56 266 0)
 (buffers 992 11))

-- 
James Mazer
[email-masked]