timmerk / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

192.168.01.131 is not a valid ip v4 address #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ip_obj = ipaddr.IPAddress('192.168.01.131')
2.
3.

What is the expected output? What do you see instead?
an Exception occurence
an instance which implies a valid ip address

What version of the product are you using? On what operating system?
version : '2.1.9' on linux

Please provide any additional information below.

I have tested the modification in:

    def _is_valid_ip(self, address):
        ...........
        for octet in octets:
            try:
                if not 0 <= int(octet) <= 255:
                    return False
                # < additional control
                if len(octet) > 1:
                    if octet[0] == '0':
                        return False
                # additional control >
            except ValueError:
                return False
        return True
        ..........

Original issue reported on code.google.com by jeanyves...@gmail.com on 15 Feb 2012 at 12:57

GoogleCodeExporter commented 9 years ago
this is by design.

see http://code.google.com/p/ipaddr-py/issues/detail?id=92

The gist is that leading zero's imply octal numbers.

Original comment by pmo...@google.com on 16 Feb 2012 at 1:49