bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-no


From: Eli Zaretskii
Subject: 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@yandex.ru>
> Cc: Eli Zaretskii <eliz@gnu.org>,
>       "67977@debbugs.gnu.org" <67977@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]