You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ethernet): a non-string MAC address raises a bare TypeError, not ProtocolError #2222
Describe the bug Ethernet._make_mac_addr documents ProtocolError for a bad address, but a bool, int, None or float reaches PAT_MAC_ADDR.fullmatch and raises a bare TypeError, which except ProtocolError / except ValueError does not catch. #2166 closed the same gap in ARP._make_addr_resolve.
Reproduction
frompcapkit.protocols.link.ethernetimportEthernetEthernet(src=True) # TypeError: expected string or bytes-like object, got 'bool'Ethernet(dst=5) # TypeError: expected string or bytes-like object, got 'int'Ethernet(src=None) # TypeError: expected string or bytes-like object, got 'NoneType'
Expected behavior
Follow ARP's Ethernet branch: a bool raises FieldValueError (checked first, since bool is an int), and anything not str, bytes or bytearray raises ProtocolError. Update the docstring's Raises: to match, and add a test per type.
System information
Linux, CPython 3.14.9, checkout main91147a182.
Activity
fix(ethernet,pcapng): reject a non-string MAC or EUI address (#2222)
fix(ethernet,pcapng): reject a non-string MAC or EUI address (#2222)
fix(ethernet,pcapng): reject a non-string MAC or EUI address (#2222) (#…
docs(changelog): seventh whole-repo pass over the changelog (#1103) (#…