Skip to content

NameError: _status_msg called without self in the error branches #33

Open

Description

@dpc00

The two error branches at the top of DistractionFreeWindowCommand.run() call _status_msg(...) as a bare function, but it is an instance method, so they raise NameError instead of showing the status message (and the widget check is exactly the case where the message was meant to appear).

if w is None:
    _status_msg('Error: Window is None')          # NameError
    return

if w.active_view().settings().get('is_widget', False):
    _status_msg('Error: Active view is a widget.')   # NameError
    return

Reproduced with the package code (Sublime stubbed):

active view is a widget   NameError: name '_status_msg' is not defined

Fix: self._status_msg(...).

Found while testing packages from the Package Control catalog.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions