(add-text-properties comint-last-output-start (point)
`(rear-nonsticky
,comint--prompt-rear-nonsticky
front-sticky
(field inhibit-line-move-field-capture)
field output
inhibit-line-move-field-capture t))
A simple fix (in python.el) would be to run the python setup from the main event loop instead of in place, i.e. to avoid recursively calling the process filter. A more defensive fix (in comint) would be to store the value of `comint-last-output-start' (or use some other “starting marker”) to guard against filter-function disturbance. This is already done for the process mark.