Skip to content

Conversation

@sobolevn
Copy link
Member

Source: https://github.com/python/cpython/blob/main/Lib/ipaddress.py

Code:

>>> from ipaddress import ip_interface
>>> ip_interface(('192.0.2.0', 24))
IPv4Interface('192.0.2.0/24')
>>> ip_interface(('192.0.2.0', ))
IPv4Interface('192.0.2.0/32')

>>> from ipaddress import ip_address
>>> a = ip_address('192.0.2.0')
>>> ip_interface((a, ))
IPv4Interface('192.0.2.0/32')
>>> ip_interface((a, 24))
IPv4Interface('192.0.2.0/24')

>>> a.packed
b'\xc0\x00\x02\x00'
>>> ip_interface((a.packed, 24))
IPv4Interface('192.0.2.0/24')
>>> ip_interface((a.packed,))
IPv4Interface('192.0.2.0/32')

Closes #8966

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 0bd4e3c into python:main Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ip_interface function accepts tuples, typing does not

2 participants