Reject embedded null bytes explicitly for cross-interpreter consistency

CPython's socket.inet_pton raises ValueError on an embedded null byte while
PyPy silently accepts it, so catching ValueError alone left is_valid_ip_address
returning True for e.g. "1.2.3.4\x00" on PyPy (and failing the regression test
there). A string with a null byte is never a valid address, so reject it
explicitly before calling inet_pton, giving the same result on every
interpreter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 file changed