Dear Maintainer,
When editing the following file, emacs will reliably hang:
$ cat bug.py
def foo(self):
"""Foo."""
"""
pass
def baz(self):
"""Ba'r."""
pass
The problem seems triggered by the single-quote in the second docstring. Upon
research, this is likely a problem specific to the version of
progmodes/python.el shipped with emacs 28.2. Although the above specific test
case did not seem to match other reports I saw.
I'm not comfortable enough mixing and matching something like emacs-el from
backports (which is 29.1) with stable emacs 28.2 (not enough experience with
emacs).
Some reference threads:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-01/msg01686.html
https://www.reddit.com/r/emacs/comments/z0oye9/emacs_freezes_when_opening_a_python_file
https://emacs.stackexchange.com/questions/74167/python-mode-hangs-on-class-member-comment