Skip to content

Commit

Permalink
don't crash if broadcast_addr() fails
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 23, 2025
1 parent e433c20 commit c1415e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2242,8 +2242,12 @@ def net_if_addrs():
# On Windows broadcast is None, so we determine it via
# ipaddress module.
if WINDOWS and fam in {socket.AF_INET, socket.AF_INET6}:
broadcast = _common.broadcast_addr(nt)
nt._replace(broadcast=broadcast)
try:
broadcast = _common.broadcast_addr(nt)
except Exception as err: # noqa: BLE001
debug(err)
else:
nt._replace(broadcast=broadcast)

ret[name].append(nt)

Expand Down

0 comments on commit c1415e9

Please sign in to comment.