Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip_interface can have tuple arguments #9195

Merged
merged 1 commit into from
Nov 14, 2022
Merged

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