ultisnips icon indicating copy to clipboard operation
ultisnips copied to clipboard

`vim_helper.py` uses broken python3 calls... `dict().iteritems()` throws AttributeError

Open mpenning opened this issue 2 years ago • 0 comments

Expected behavior: No python3 syntax errors

Actual behavior: Please note that I'm just highlighting the broken call below. The syntax error is in .vim/bundle/ultisnips/pythonx/UltiSnips/vim_helper.py, line 104. Someone appears to have written this under python2... also see PEP-0469 and PEP-3106, which deprecates dict().iteritems().

The demo below reproduces what essentially is happening... we're calling dict().iteritems() in vim_helper.py

>>> # py3 supported syntax..
>>> {}.items()
dict_items([])
>>>
>>> # py3 NOT supported syntax... dict().iteritems() 
>>> {}.iteritems()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'iteritems'
>>>

Steps to reproduce

  1. Open .vim/bundle/ultisnips/pythonx/UltiSnips/vim_helper.py and check line 103 / line 104
  2. Invalid syntax in line 104... dict().iteritems() doesn't exist in python3.

  • Operating System: Debian 11
  • Vim Version:
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
Included patches: 1-2434
Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428
  • UltiSnips Version: I got it from SirVer/ultisnips git HEAD. I think it's 3.2 + any post-release commits in master
  • Python inside Vim: python 3.9.2
  • Docker repo/vimrc: My ~/.vimrc <-- github permalink

Thank you for such a useful lib... best... mike

mpenning avatar May 19 '22 00:05 mpenning