py-compute-indentation crasher breaks editing
With the following code (reduced to the simplest case I could):
def my_func(self):
this_line() # is bad
if condition:
pass
On line 2 (with the comment), using delete or backspace anywhere on the line from the first non-whitespace character onwards, results in the error:
if: ‘py-compute-indentation’ reached loops max.
and, most annoyingly, the character is not deleted. I have to use some other way of deleting characters to work around it.
The if condition
(or something other block that increases indentation e.g. nested function or with statement) seems to be important in triggering this, and the inline comment is also important. I'm experiencing this error in slightly different contexts quite a lot, and it makes editing quite tricky.
I've tested against the most recent version of python-mode in Elpa, and ran Emacs like this:
emacs -q -l ~/.emacs.d/elpa/python-mode-20220723.1637/python-mode.el test.py
Emacs version:
$ emacs --version
GNU Emacs 28.1
I'm using emacs28-nativecomp
packages from the Ubuntu ppa:kelleyk/emacs
PPA.