Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError: maximum recursion depth exceeded in comparison #1532

Open
Hubro opened this issue Jul 8, 2023 · 4 comments
Open

RecursionError: maximum recursion depth exceeded in comparison #1532

Hubro opened this issue Jul 8, 2023 · 4 comments

Comments

@Hubro
Copy link

Hubro commented Jul 8, 2023

Sorry in advance, but I am unable to reproduce this issue, it seems to happen at random maybe a couple of times per day. I have tried to find a way to reproduce it the last couple of weeks, but I can't. It's annoying me so much I need to post it, in case you have an easy solution.

Sometimes my editor freezes for a long time before I get this error (like minutes), other times I get it instantly after filling out a snippet.

The last couple of times the error happened, it was while filling in a Rust LSP-provided snippet inside of a custom Ultisnips snippet, i.e.:

assert_eq!(
    unique_paths(3, 7),
    28,
);

assert_eq! above is a custom Ultisnips snippet, where I expanded the unique_paths snippet from the LSP in the first position. I got the error when pressing <Esc> to leave the snippet context.

The error is:

An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition. If you think this is a bug, please report it to
https://github.com/SirVer/ultisnips/issues/new
Please read and follow:
https://github.com/SirVer/ultisnips/blob/master/CONTRIBUTING.md#reproducing-bugs

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 47, in wrapper
    return func(self, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 415, in _cursor_moved
    self._active_snippets[0].replay_user_edits(es, self._ctab)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/snippet_instance.py", line 70, in replay_user_edits
    self._do_edit(cmd, ctab)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 274, in _do_edit
    self._do_edit(child)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 274, in _do_edit
    self._do_edit(child)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 274, in _do_edit
    self._do_edit(child)
  [Previous line repeated 958 more times]
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 246, in _do_edit
    child._do_edit(cmd, ctab)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 290, in _do_edit
    self._child_has_moved(idx, pivot, delta)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 304, in _child_has_moved
    child._move(pivot, diff)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 296, in _move
    child._move(pivot, diff)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 293, in _move
    TextObject._move(self, pivot, diff)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/text_objects/base.py", line 67, in _move
    self._start.move(pivot, diff)
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/position.py", line 23, in move
    if self < pivot:
       ^^^^^^^^^^^^
  File "/home/tomas/.local/share/nvim/lazy/ultisnips/pythonx/UltiSnips/position.py", line 62, in __lt__
    return (self.line, self.col) < (other.line, other.col)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded in comparison

Has anybody else had this same issue? Is there something obvious causing it?


  • Operating System: Arch Linux
  • Vim Version: NVIM v0.9.1
  • UltiSnips Version: 24bca5c
  • Python inside Vim: 3.11.3
  • Docker repo/vimrc: 😞
@SirVer
Copy link
Owner

SirVer commented Jul 9, 2023 via email

@Hubro
Copy link
Author

Hubro commented Jul 9, 2023

@SirVer Of course, though it's so simple I assumed it wasn't relevant:

snippet assert_eq "An assertion" b
assert_eq!(
	${1:A},
	${0:B},
);
endsnippet

@SirVer
Copy link
Owner

SirVer commented Jul 18, 2023

Indeed, that snippet should not trigger such behaviour easily. So much more likely that there is interplay between UltiSnips and a different plugin.

Please provide a fully reproducible example, ideally using the approach explained in https://github.com/SirVer/ultisnips/blob/master/CONTRIBUTING.md#reproducing-bugs or if not possible with a minimal vimrc and snippets files and an exact sequence of key strokes that trigger the bug.

@Hubro
Copy link
Author

Hubro commented Jul 19, 2023

@SirVer I wish I could, but as I said in the original post, I'm unable to replicate it consistently, it seems to happen at random. It seems to be related to the interweaving of UltiSnips snippets and LSP snippets. It hasn't happened for a few days now (since I was working on a Rust project), so it might even be specific to the rust-analyzer LSP.

From now on, I'll make note of what I'm doing when this crash happens, and hopefully a pattern will emerge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants