summaryrefslogtreecommitdiff
path: root/pylint/message/message_handler_mix_in.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-30 09:26:02 +0200
committerGitHub <noreply@github.com>2021-03-30 09:26:02 +0200
commitc92e3ab78778aa1afcf4ddca4829245d37fbc095 (patch)
tree4776f4c73f73f3b278d7db207f585799c2b23d3b /pylint/message/message_handler_mix_in.py
parentc1c41b849ce070447f3efe4ed1a91068d4c85362 (diff)
downloadpylint-git-pylint-2.7.4.tar.gz
Fix disabled warning not ignored (#4268)pylint-2.7.4
* Fix ignores all disabled warnings #4265 * Update changelog and prepare 2.7.4
Diffstat (limited to 'pylint/message/message_handler_mix_in.py')
-rw-r--r--pylint/message/message_handler_mix_in.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pylint/message/message_handler_mix_in.py b/pylint/message/message_handler_mix_in.py
index 8667c84f8..2a15a76bb 100644
--- a/pylint/message/message_handler_mix_in.py
+++ b/pylint/message/message_handler_mix_in.py
@@ -45,10 +45,14 @@ class MessagesHandlerMixIn:
def _register_by_id_managed_msg(self, msgid_or_symbol: str, line, is_disabled=True):
"""If the msgid is a numeric one, then register it to inform the user
it could furnish instead a symbolic msgid."""
- if msgid_or_symbol[1:].isdigit():
- symbol = self.msgs_store.message_id_store.get_symbol(msgid=msgid_or_symbol) # type: ignore
- managed = (self.current_name, msgid_or_symbol, symbol, line, is_disabled) # type: ignore
- MessagesHandlerMixIn.__by_id_managed_msgs.append(managed)
+ try:
+ if msgid_or_symbol[1:].isdigit():
+ symbol = self.msgs_store.message_id_store.get_symbol(msgid=msgid_or_symbol) # type: ignore
+ msgid = msgid_or_symbol
+ managed = (self.current_name, msgid, symbol, line, is_disabled) # type: ignore
+ MessagesHandlerMixIn.__by_id_managed_msgs.append(managed)
+ except KeyError:
+ pass
def disable(self, msgid, scope="package", line=None, ignore_unknown=False):
"""Don't output message of the given id"""