GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — IP Interface is_unspecified broken · Issue #115766 · python/cpython

IP Interface is_unspecified broken #115766

New issue
Copy link
New issue
Copy link
Closed
Closed
IP Interface is_unspecified broken#115766
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@joeyberkovitz
joeyberkovitz
opened on Feb 21, 2024
Issue body actions

Bug report

Bug description:

from ipaddress import ip_interface

ip_interface('0.0.0.0/32').is_unspecified == False
ip_interface('0.0.0.0/32').network.is_unspecified == True
ip_interface('0.0.0.0/32').ip.is_unspecified == True

Per the documentation, the IP interface classes inherit all properties from the associated address classes. As such, is_unspecified is available as a property, although as implemented now, it will always return False for an interface.

Given that an interface is just a network and host combined, it might be reasonable for the implementation of is_unspecified to be something along the lines of self.network.is_unspecified and self.ip.is_unspecifed, possibly implemented more efficiently (for example self._ip == 0 and self._prefixlen == 32 for IPv4)

The current implementation isn't specified for an interface, so it falls back to the address implementation which checks if the address equals '0.0.0.0', although this subtly always fails because the interface equality function is used which will never return True comparing an interface and address object.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-115766: Fix IPv4Interface.is_unspecified #137326

Activity

  1. joeyberkovitz
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 21, 2024
  2. encukou
    added this to ipaddress issueson Dec 19, 2024
  3. aisk commented on Aug 2, 2025

    @aisk
    aisk
    on Aug 2, 2025
    Member
    More actions

    IPv6Interface.is_unspecified is already supported, so we just need add support for IPv4Interface.is_unspecified.

  4. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Aug 2, 2025
  5. encukou
    added a commit that references this issue on Aug 11, 2025

    gh-115766: Fix IPv4Interface.is_unspecified (GH-137326)

    deb0020
  6. encukou commented on Aug 11, 2025

    @encukou
    encukou
    on Aug 11, 2025
    Member
    More actions

    Thank you for the fix!

    Given that it's a behaviour change, I don't think it should be backported. Please comment/reopen if you disagree.

  7. encukou
    closed this as completedon Aug 11, 2025
  8. github-project-automation
    moved this to Done in ipaddress issueson Aug 11, 2025
  9. maurycy
    added a commit that references this issue on Aug 12, 2025

    Merge branch 'main' into csv-sniffer-counter-set

    11c891d
  10. Agent-Hellboy
    added a commit that references this issue on Aug 19, 2025

    pythongh-115766: Fix IPv4Interface.is_unspecified (pythonGH-137326)

    2672f7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • ipaddress issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.