X Tutup
The Wayback Machine - https://web.archive.org/web/20241129042654/https://github.com/python/cpython/issues/88178
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

IPv6Address.exploded does not support interface name (scope id) #88178

Open
ohwgiles mannequin opened this issue May 2, 2021 · 3 comments
Open

IPv6Address.exploded does not support interface name (scope id) #88178

ohwgiles mannequin opened this issue May 2, 2021 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@ohwgiles
Copy link
Mannequin

ohwgiles mannequin commented May 2, 2021

BPO 44012
Nosy @ohwgiles
PRs
  • bpo-44012: IPv6Address.exploded with scope_id #25824
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-05-02.21:47:15.478>
    labels = ['library']
    title = 'IPv6Address.exploded does not support interface name (scope id)'
    updated_at = <Date 2021-05-02.22:00:23.213>
    user = 'https://github.com/ohwgiles'

    bugs.python.org fields:

    activity = <Date 2021-05-02.22:00:23.213>
    actor = 'ohwgiles'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-05-02.21:47:15.478>
    creator = 'ohwgiles'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44012
    keywords = ['patch']
    message_count = 1.0
    messages = ['392740']
    nosy_count = 1.0
    nosy_names = ['ohwgiles']
    pr_nums = ['25824']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue44012'
    versions = []

    @ohwgiles
    Copy link
    Mannequin Author

    ohwgiles mannequin commented May 2, 2021

    IPv6 addresses may contain a scope id, for example "fe80::1%eth0".

    These are usually required for link-local addresses.

    bpo-34788 added support for scoped IPv6 addresses, but missed the
    "exploded" method:

    >>> import ipaddress
    >>> ipaddress.IPv6Address('fe80::1%eth0').exploded
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.9/ipaddress.py", line 394, in exploded
        return self._explode_shorthand_ip_string()
      File "/usr/lib/python3.9/ipaddress.py", line 1824, in _explode_shorthand_ip_string
        ip_int = self._ip_int_from_string(ip_str)
      File "/usr/lib/python3.9/ipaddress.py", line 1705, in _ip_int_from_string
        raise AddressValueError("%s in %r" % (exc, ip_str)) from None
    ipaddress.AddressValueError: Only hex digits permitted in '1%eth0' in 'fe80::1%eth0'

    @ohwgiles ohwgiles mannequin added stdlib Python modules in the Lib dir labels May 2, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @malvidin
    Copy link

    Is it out of scope for this bug to add this check for additional invalid IPv6 Scope IDs?

        elif not scope_id or '%' in scope_id or '\x00' in scope_id: 

    elif not scope_id or '%' in scope_id:

    Based on RFC4007, section 11.2, paragraph 5
    https://datatracker.ietf.org/doc/html/rfc4007.html#section-11.2

    @NeevCohen
    Copy link

    I'd like to work on a fix for this. Is this issue still available?

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants
    X Tutup