Subject: bug#30964: python-mode failing "overlapping strings" assertion lately

From: Clément Pit-Claudel <[email-masked]>
Date: Fri, 18 May 2018 11:46:26 -0400

(Hoping that emailing the bug address is enough to respond to an existing bug, and that I didn't miss recent follow-ups)

(Resending, since I apparently emailed the wrong bug number at first)

Here's a reliable repro:

def f():
    "

def g():
    """That's a docstring"""
    return ''

Place the point after the unclosed quote in f, and run (python-info-current-defun).  You get this:

Debugger entered--Lisp error: (cl-assertion-failed ((> string-start last-string-end) "Overlapping strings detected (start=%d, last-end=%d)" 67 67))
  cl--assertion-failed((> string-start last-string-end) "Overlapping strings detected (start=%d, last-end=%d)" (67 67) nil)
  python-nav-end-of-statement()
  python-nav-end-of-defun()
  python-info-current-defun()
  eval((python-info-current-defun) nil)
  eval-expression((python-info-current-defun) nil nil 127)
  funcall-interactively(eval-expression (python-info-current-defun) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

This error triggers in the wild for me due to which-function-mode, which calls python-info-current-defun.

Clément.