SublimeMarkAndMove icon indicating copy to clipboard operation
SublimeMarkAndMove copied to clipboard

dict.iteritems() (Python 2 only) in fix_ids raises AttributeError when a linked tab was closed and gets reopened

Open dpc00 opened this issue 2 months ago • 1 comments

MarkAndMoveWindowCommand.fix_ids() calls dict.iteritems() three times (lines 49, 74 and 81), which only exists in Python 2. Sublime Text 3/4 run plugins on Python 3 (3.3 here, since the package has no .python-version), where a dict has no iteritems, so every call raises AttributeError.

fix_ids() is used whenever a linked view's id changes, i.e. when the target file's tab was closed and the plugin re-opens it (lookup_view → open_file → fix_ids) and from remember_file_name(). So jumping to a linked tab that has since been closed does not work.

Reproduced with the installed release 2.1.2 (mark_and_move.py is byte-identical to HEAD 7e418ad, sha256 7f4ea2d6...679): link view A → view B, close B's tab (its file still exists), then call the package's own lookup_view() for B's old id:

  File "mark_and_move.py", line 38, in lookup_view
  File "mark_and_move.py", line 49, in fix_ids
AttributeError: 'dict' object has no attribute 'iteritems'

Fix: use .items() in the three places (list(d.items()) where the dict is modified while iterating, as in the loop at line 81 which assigns into self.mark_and_move_views).

dpc00 avatar Sep 25 '26 12:09 dpc00

Claude reports: closing this after 30 days with no response. Reopen it if it is still relevant.

dpc00 avatar Oct 27 '26 19:10 dpc00