Commits

Can Xue committed 63d4c3e

support instant an Address by another Address now

  • Participants
  • Parent commits d91cd7d

Comments (0)

Files changed (1)

File kahgean/ipv4addr.py

             value = Address._init_from_seq(address.strip().split('.'))
         elif isinstance(address, Sequence):
             value = Address._init_from_seq(address)
-        elif type(address) in [int, long]:
+        elif type(address) in [int, long, Address]:
             value = Address._init_from_int(address)
         else:
             raise ValueError('unsupported address type')
             
     @staticmethod
     def _init_from_int(value):
+        value = long(value)
         if value<0 or value>2**32-1:
             raise ValueError('value should be in [0, 2**32-1]')
         return value