In this problem, I am working with IPv6 network address spaces, therefore the length is It appears that the dragon (at least on this machine) will face a 64 bit signed number from to LAN (IP ('2001 :: / 64')), long int is too large to be questioned on the IPy library. Any suggestions on how to handle it, or the sign that it might be a limitation? I The issue you're killing is that one of the containers in the Python's C API There is a system-dependent limit. That is, the C function The builtin Instead of calling builtin This is a pure python, so this is no limit on the integer shape. 2 ^ (128 - subnet) .
__en () lane (IP ('2001 :: / 66')) works , but
lane fails (IP ('2001 :: / 65')) . From the IPI import IP lane (IP ('2001 :: / 64')) Traceback (most recent call final): File "test.py", line 2, & lt; Module & gt; To convert overflow error: int int
PyObject_Size returns a
Py_ssize_t value, which is a signed version of standard C
size_t type. This size is dependent on the system, but 32-bit systems have 64 bits on 32 bits and 64-bit systems.
len function is used by
PyObject_Size , so it has its own limitations here:
Fixed PyObject * Builtin_len (PyObject * self, PyObject * v) {Py_ssize_t res; Res = PyObject_Size (v); If (RAS & lt; 0 & amp; amp; amp;; PyErr_Occurred ()) return; Return PIINT_From SSIID_T (RAC); }
you work around this limit using the
len method on the
IP object You can. Len :
IP ('2001 :: / 64'). Len ()
No comments:
Post a Comment