fix: tolerate removing unregistered record listener by bluetoothbot · Pull Request #1783 · python-zeroconf/python-zeroconf
-
Notifications
You must be signed in to change notification settings - Fork 228
Conversation
Demonstrates GHSA-5pv9-xcmm-gqc7: set.remove() raises KeyError, which the except ValueError clause cannot catch.
self.listeners is a set, so .remove() raises KeyError, never ValueError — the existing except clause could not catch the only realistic failure mode. Switch to the set-native discard idiom so removing a listener that was never registered (e.g. during teardown / reconnect sequences) no longer breaks the shutdown flow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters