GNU bug report logs - #67977
30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer

Previous Next

Package: emacs;

Reported by: Denis Zubarev <dvzubarev <at> yandex.ru>

Date: Fri, 22 Dec 2023 23:19:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 30.1

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #59 received at 67977 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Denis Zubarev <dvzubarev <at> yandex.ru>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: casouri <at> gmail.com, 67977 <at> debbugs.gnu.org
Subject: Re: bug#67977: 30.0.50;
 tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed
 buffer
Date: Sun, 31 Dec 2023 14:56:25 +0200
> From: Denis Zubarev <dvzubarev <at> yandex.ru>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,
> 	"67977 <at> debbugs.gnu.org" <67977 <at> debbugs.gnu.org>
> Date: Sun, 31 Dec 2023 13:39:10 +0300
> 
> Yes, if accessing nodes, then there is a slowdown.
>  
> The result is what benchmark-run returns.
>  
>  # func  buff-size  widen                 narrowed                
> ------------------------------------------------------------------
>       1  671 B      (0.22944 2 0.022735)  (0.520645 9 0.1100442)  
>      11  7 KiB      (0.23176 3 0.038288)  (0.9340281 9 0.116293   
>      31  20 KiB     (0.27746 3 0.039054)  (1.7671007 10 0.134515)
>  
> Also there were errors when running benchmark in the narrowed buffer:
> Error muted by safe_call: (internal--syntax-propertize 1482) signaled (args-out-of-range 1 1872)
> Error muted by safe_call: (internal--syntax-propertize 282) signaled (args-out-of-range 1 672)
> 
>  
> Recipe:
> 1. emacs -Q
> 2. paste the code to the buffer
> 3. M-x python-ts-mode
> 4. put the cursor in the place of |
>  
> 5. M-x eval-expression
>    (require 'benchmark)
>    (benchmark-run 200 (progn (insert "v")  (insert "=") (insert "f") (insert "(") (insert ")") (treesit-node-at
> (point)) (insert "\n") (font-lock-ensure) ))
> 6. M-x undo
>  
> For benchmark in narrowed state select the body of a function, starting from a documentation string
> and M-x narrow-to-region.
>  
> To increase buffer size copy the whole function:
> M-x eval-expression
> (dotimes (_ 10) (yank))
> 
>  
> Code:
> class TempC:
>     def func_call():
>         """documentation
>         """
>         var1 = 3
>         var2 = func(1, temp={'1':1, '2':2},
>                     temp1=TempC([1], [3]), ab='83, 8',)
>         var3= r'\n str'
>         var4 = f'temp {TempC("1"+"3")}|{v + "mon" +v}and {func()}'
>  
>         |
>  
>         varb =832
>         if varb:
>             pass
>         elif not varb is not None and varb == 3:
>             varb = 38
>         else:
>             pass
>  
>         for i in range():
>             print(i)
>  
>         def nested():
>             class Nested(Tempc):
>                 def __init__(self):
>                     self._init = True
>             return Nested()
>         return nested

Adding Stefan to the discussion.




This bug report was last modified 1 year and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.