GNU bug report logs -
#29174
26.0.90; wrong-type-argument in the Python Flymake backend
Previous Next
Reported by: Lele Gaifax <lele <at> metapensiero.it>
Date: Mon, 6 Nov 2017 19:23:01 UTC
Severity: normal
Found in version 26.0.90
Done: joaotavora <at> gmail.com (João Távora)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 09 Nov 2017 21:29:58 +0000
with message-id <87po8ri1ih.fsf <at> gmail.com>
and subject line Re: bug#29174: 26.0.90; wrong-type-argument in the Python Flymake backend
has caused the debbugs.gnu.org bug report #29174,
regarding 26.0.90; wrong-type-argument in the Python Flymake backend
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
29174: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29174
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From time to time, while editing a python-mode with flymake-mode enabled, I
somehow trigger an error in the backend.
Unfortunately I'm not able to reproduce the problem in a deterministic way: it
really seems a timing issue, that is I was able to get it quickly
adding/removing random characters, but not too fast so to give Flymake the
opportunity to run the checker subprocess.
My guess is that it is another case of "the checker tool reported a line/col
position that does not exist anymore in the buffer", but the traceback below
does not seem to support my supposition, where in particular I fail to
understand from where the `t' that eventually is given to `cdr' may come from:
of course it may very well be due to my extremely low elisp-fu tricking
me... :-)
Here is a traceback (obtained after re-evaluating the
`python--flymake-parse-output' function source):
Debugger entered--Lisp error: (wrong-type-argument listp t)
cdr(t)
(setq end (cdr end))
(prog1 end (setq end (cdr end)))
(car-safe (prog1 end (setq end (cdr end))))
(setq end (flymake-diag-region source (string-to-number (match-string lineidx)) (and colidx (match-string colidx) (string-to-number (match-string colidx)))) beg (car-safe (prog1 end (setq end (cdr end)))))
(while (search-forward-regexp rx nil t) (setq msg (match-string msgidx)) (setq end (flymake-diag-region source (string-to-number (match-string lineidx)) (and colidx (match-string colidx) (string-to-number (match-string colidx)))) beg (car-safe (prog1 end (setq end (cdr end))))) (setq type (or (and typeidx (match-string typeidx) (assoc-default (match-string typeidx) python-flymake-msg-alist (function string-match))) (assoc-default msg python-flymake-msg-alist (function string-match)) :error)) (setq diags (nconc diags (list (flymake-make-diagnostic source beg end type msg)))))
(let* ((msg nil) (end nil) (beg nil) (type nil) (diags nil)) (while (search-forward-regexp rx nil t) (setq msg (match-string msgidx)) (setq end (flymake-diag-region source (string-to-number (match-string lineidx)) (and colidx (match-string colidx) (string-to-number (match-string colidx)))) beg (car-safe (prog1 end (setq end (cdr end))))) (setq type (or (and typeidx (match-string typeidx) (assoc-default (match-string typeidx) python-flymake-msg-alist (function string-match))) (assoc-default msg python-flymake-msg-alist (function string-match)) :error)) (setq diags (nconc diags (list (flymake-make-diagnostic source beg end type msg))))) (funcall report-fn diags) nil)
(save-current-buffer (set-buffer (process-buffer proc)) (goto-char (point-min)) (let* ((msg nil) (end nil) (beg nil) (type nil) (diags nil)) (while (search-forward-regexp rx nil t) (setq msg (match-string msgidx)) (setq end (flymake-diag-region source (string-to-number (match-string lineidx)) (and colidx (match-string colidx) (string-to-number (match-string colidx)))) beg (car-safe (prog1 end (setq end (cdr end))))) (setq type (or (and typeidx (match-string typeidx) (assoc-default (match-string typeidx) python-flymake-msg-alist (function string-match))) (assoc-default msg python-flymake-msg-alist (function string-match)) :error)) (setq diags (nconc diags (list (flymake-make-diagnostic source beg end type msg))))) (funcall report-fn diags) nil))
(let ((rx (nth 0 python-flymake-command-output-pattern)) (lineidx (nth 1 python-flymake-command-output-pattern)) (colidx (nth 2 python-flymake-command-output-pattern)) (typeidx (nth 3 python-flymake-command-output-pattern)) (msgidx (nth 4 python-flymake-command-output-pattern))) (save-current-buffer (set-buffer (process-buffer proc)) (goto-char (point-min)) (let* ((msg nil) (end nil) (beg nil) (type nil) (diags nil)) (while (search-forward-regexp rx nil t) (setq msg (match-string msgidx)) (setq end (flymake-diag-region source (string-to-number (match-string lineidx)) (and colidx (match-string colidx) (string-to-number (match-string colidx)))) beg (car-safe (prog1 end (setq end (cdr end))))) (setq type (or (and typeidx (match-string typeidx) (assoc-default (match-string typeidx) python-flymake-msg-alist (function string-match))) (assoc-default msg python-flymake-msg-alist (function string-match)) :error)) (setq diags (nconc diags (list (flymake-make-diagnostic source beg end type msg))))) (funcall report-fn diags) nil)))
python--flymake-parse-output(#<buffer tables/user_logins.py> #<process python-flymake> #f(compiled-function (&rest args) #<bytecode 0x1da5a89>))
(progn (python--flymake-parse-output source proc report-fn))
(if (save-current-buffer (set-buffer source) (eq proc python--flymake-proc)) (progn (python--flymake-parse-output source proc report-fn)))
(unwind-protect (if (save-current-buffer (set-buffer source) (eq proc python--flymake-proc)) (progn (python--flymake-parse-output source proc report-fn))) (kill-buffer (process-buffer proc)))
(progn (unwind-protect (if (save-current-buffer (set-buffer source) (eq proc python--flymake-proc)) (progn (python--flymake-parse-output source proc report-fn))) (kill-buffer (process-buffer proc))))
(if (eq 'exit (process-status proc)) (progn (unwind-protect (if (save-current-buffer (set-buffer source) (eq proc python--flymake-proc)) (progn (python--flymake-parse-output source proc report-fn))) (kill-buffer (process-buffer proc)))))
(closure ((source . #<buffer tables/user_logins.py>) (_args) (report-fn . #f(compiled-function (&rest args) #<bytecode 0x1da5a89>)) outline-heading-end-regexp python-shell--interpreter python-shell--interpreter-args ffap-alist comint-last-prompt-overlay t) (proc _event) (if (eq 'exit (process-status proc)) (progn (unwind-protect (if (save-current-buffer (set-buffer source) (eq proc python--flymake-proc)) (progn (python--flymake-parse-output source proc report-fn))) (kill-buffer (process-buffer proc))))))(#<process python-flymake> "exited abnormally with code 1\n")
Thanks a lot,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele <at> metapensiero.it | -- Fortunato Depero, 1929.
[Message part 3 (message/rfc822, inline)]
Lele Gaifax <lele <at> metapensiero.it> writes:
>>From time to time, while editing a python-mode with flymake-mode enabled, I
> somehow trigger an error in the backend.
>
> Unfortunately I'm not able to reproduce the problem in a deterministic way: it
> really seems a timing issue, that is I was able to get it quickly
> adding/removing random characters, but not too fast so to give Flymake the
> opportunity to run the checker subprocess.
>
> My guess is that it is another case of "the checker tool reported a line/col
> position that does not exist anymore in the buffer",
Yes, that is probably the case, but in that discussion we decided it is
normal from time to time, especially if you quickly remove characters
from the buffer end after check has already started. So it is probably
the "same" case, not another case.
> but the traceback below does not seem to support my supposition, where
> in particular I fail to understand from where the `t' that eventually
> is given to `cdr' may come from: of course it may very well be due to
> my extremely low elisp-fu tricking me... :-)
The problem is the (beg . end) = (flymake-diag-region...) clause in the
cl-loop. That call assumes that flymake-diag-region will always return a
cons, or nil, but it this case (the invalid region case), it was
returning t instead. That doesn't destructure nicely into (beg . end),
and so errors with a cryptic backtrace that confused you.
Fixed this in 89382780e1729861d98eca6e028ca1c62662a59f.
Thanks,
João
This bug report was last modified 7 years and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.