]> git.eshelyaron.com Git - emacs.git/commit
Protect against an infloop in python-mode
authorPhilipp Stephani <phst@google.com>
Tue, 28 Feb 2017 21:21:37 +0000 (22:21 +0100)
committerPhilipp Stephani <phst@google.com>
Thu, 23 Mar 2017 22:05:19 +0000 (23:05 +0100)
commit4fbd330fae54a9c45d4a717127aa86d75e9938d5
tree7af5dde9a3194b504fe6b837a6339b7683d8efa6
parentaa0fb4fed8ef1f3599f573476fc6291f8872c7e7
Protect against an infloop in python-mode

There appears to be an edge case caused by using `syntax-ppss' in a
narrowed buffer during JIT lock inside of Python triple-quote strings.
Unfortunately it is impossible to reproduce without manually
destroying the syntactic information in the Python buffer, but it has
been observed in practice.  In that case it can happen that the syntax
caches get sufficiently out of whack so that there appear to be
overlapping strings in the buffer.  As Python has no nested strings,
this situation is impossible and leads to an infloop in
`python-nav-end-of-statement'.  Protect against this by checking
whether the search for the end of the current string makes progress.

* python.el (python-nav-end-of-statement): Protect against infloop.
* progmodes/python-tests.el
(python-tests--python-nav-end-of-statement--infloop): Add unit test.
lisp/progmodes/python.el
test/lisp/progmodes/python-tests.el