Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix broadcast address being discarded in net_if_addrs on Windows#2836

Merged
giampaolo merged 2 commits into
giampaolo:masterfrom
tklauser:broadcast-windows
May 21, 2026
Merged

Fix broadcast address being discarded in net_if_addrs on Windows#2836
giampaolo merged 2 commits into
giampaolo:masterfrom
tklauser:broadcast-windows

Conversation

@tklauser
Copy link
Copy Markdown
Contributor

Summary

Description

_replace() returns a new namedtuple instance. Thus, the result needs to be assigned back. Otherwise the computed broadcast address is silently dropped. This fixes a bug with the broadcast field of net_if_addrs() being empty on Windows.

_replace() returns a new namedtuple instance. Thus, the result needs to
be assigned back. Otherwise the computed broadcast address is silently
dropped.

This fixes a bug with the broadcast field of net_if_addrs() being empty
on Windows.
@tklauser tklauser force-pushed the broadcast-windows branch from d89c51c to aa54ada Compare May 21, 2026 08:25
@giampaolo
Copy link
Copy Markdown
Owner

/changelog

@github-actions
Copy link
Copy Markdown
Contributor

docs/changelog.rst entry added under Bug fixes:

- :gh:`2711`, [Windows]: :func:`net_if_addrs()` was returning ``None`` for
  the ``broadcast`` field of network interfaces instead of the correct
  broadcast address.

docs/credits.rst entry added:

* :user:`Tobias Klauser <tklauser>` - :gh:`2711`

@giampaolo
Copy link
Copy Markdown
Owner

Yes, that was clearly a bug that passed unnoticed. Thanks.

@giampaolo giampaolo merged commit 1a2569d into giampaolo:master May 21, 2026
@tklauser tklauser deleted the broadcast-windows branch May 21, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] broadcast field of net_if_addrs still none with psutil > 7.0.0

2 participants