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

ipaddress.IPv4Address.is_global not implemented #65585

Closed
rluethi mannequin opened this issue Apr 29, 2014 · 8 comments
Closed

ipaddress.IPv4Address.is_global not implemented #65585

rluethi mannequin opened this issue Apr 29, 2014 · 8 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rluethi
Copy link
Mannequin

rluethi mannequin commented Apr 29, 2014

BPO 21386
Nosy @ncoghlan, @ericvsmith, @bitdancer, @berkerpeksag
Files
  • ipv4addr_global.diff
  • ipv4addr_global2-hg.diff
  • issue21386_v3.diff
  • 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 = <Date 2016-06-11.19:13:06.496>
    created_at = <Date 2014-04-29.11:35:35.595>
    labels = ['type-bug', 'library']
    title = 'ipaddress.IPv4Address.is_global not implemented'
    updated_at = <Date 2016-06-11.19:13:06.495>
    user = 'https://bugs.python.org/rluethi'

    bugs.python.org fields:

    activity = <Date 2016-06-11.19:13:06.495>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-06-11.19:13:06.496>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2014-04-29.11:35:35.595>
    creator = 'rluethi'
    dependencies = []
    files = ['35092', '35281', '43337']
    hgrepos = []
    issue_num = 21386
    keywords = ['patch']
    message_count = 8.0
    messages = ['217511', '218701', '218744', '219017', '219861', '268162', '268252', '268253']
    nosy_count = 8.0
    nosy_names = ['ncoghlan', 'eric.smith', 'pmoody', 'r.david.murray', 'santoso.wijaya', 'python-dev', 'berker.peksag', 'rluethi']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21386'
    versions = ['Python 3.5', 'Python 3.6']

    @rluethi
    Copy link
    Mannequin Author

    rluethi mannequin commented Apr 29, 2014

    Lib/ipaddress.py does not implement is_global for IPv4Address, in contrast to the documentation which states for IPv4Address.is_global: "True if the address is allocated for public networks."

    A patch like the one attached to this report should fix that.

    @rluethi rluethi mannequin added the stdlib Python modules in the Lib dir label Apr 29, 2014
    @bitdancer
    Copy link
    Member

    The patch looks correct to me, but we also need tests.

    @rluethi
    Copy link
    Mannequin Author

    rluethi mannequin commented May 18, 2014

    New patch includes tests.

    Lightly tested with Python 3.4 (because trunk doesn't build for me right now): tests fail without patch, pass with patch.

    Patch re-diffed against trunk.

    @santosowijaya santosowijaya mannequin added the type-feature A feature request or enhancement label May 19, 2014
    @berkerpeksag
    Copy link
    Member

    + @Property
    + def is_global(self):
    + return (not self in IPv4Network('100.64.0.0/10') and

    Can IPv4Network('100.64.0.0/10') moved to the _IPv4Constants class (e.g. _IPv4Constants._global_network = IPv4Network('100.64.0.0/10')) after http://hg.python.org/cpython/rev/e5d963cb6afc (see also bpo-21513)

    + not self.is_private)

    @rluethi
    Copy link
    Mannequin Author

    rluethi mannequin commented Jun 6, 2014

    Seeing that the patch merged for bpo-21513 left the existing test for 100.64.0.0 (IPv4 network) untouched, I think it would make more sense to make that address a constant everywhere in a separate patch (if that is indeed desirable).

    @berkerpeksag
    Copy link
    Member

    Here is an updated patch that uses my proposal in msg219017. Since this is already documented at https://docs.python.org/3.5/library/ipaddress.html#ipaddress.IPv4Address.is_global I think it should also go into 3.5.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 11, 2016

    New changeset d65191861599 by Berker Peksag in branch '3.5':
    Issue bpo-21386: Implement missing IPv4Address.is_global property
    https://hg.python.org/cpython/rev/d65191861599

    New changeset 1519ca772e54 by Berker Peksag in branch 'default':
    Issue bpo-21386: Merge from 3.5
    https://hg.python.org/cpython/rev/1519ca772e54

    @berkerpeksag
    Copy link
    Member

    Thanks Roger!

    @berkerpeksag berkerpeksag added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Jun 11, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants