Subject: bug#54996: Emacs hangs when editing Python code with debug-on-error set to t

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 17 Apr 2022 22:43:00 +0200

Richard Stanton <[email-masked]> writes:

> Put the cursor right at the start of the file, on the first double
> quote, and press ‘, the single quote character. On my machine, Emacs
> now hangs and doesn’t respond to the keyboard. Without debug-on-error,
> this works just fine.

I can reproduce this, too (on Debian/bookworm).  `C-g' does work to
break it, but then it just hangs again almost immediately, so I guess
it's a problem in font-locking.

But it's bizarre that the debug-on-error setting should affect this.
I've skimmed through python.el looking for anything obvious (like a
`condition-case-unless-debug' but can't find anything).

The culprit must be in python-syntax-stringify -- if I just remove that,
the hang is gone.  But there's no odd error handling there that I can
see (unless it's hiding in syntax-ppss)...  anybody got any ideas?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no