py-radix
py-radix copied to clipboard
DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
import radix
import socket
rtree = radix.Radix()
rnode = rtree.add("10.0.0.0/8")
rnode.data["blah"] = "whatever you want"
rnode = rtree.add("10.0.0.0/16")
rnode = rtree.add("10.0.0.0", 16)
rnode = rtree.add(network = "10.0.0.0", masklen = 16)
#binary_addr = socket.inet_ntoa("172.18.22.0")
binary_addr = socket.inet_aton("172.18.22.0")
rnode = rtree.add(packed = binary_addr, masklen = 23) #line 48
classify.py:48: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats rnode = rtree.add(packed = binary_addr, masklen = 23)
On Python 3.10, this is an error:
The current failure is:
======================================================================
ERROR: test_14__packed_addresses4 (tests.test_regression.TestRadix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/py-radix-0.9.3/tests/test_regression.py", line 201, in test_14__packed_addresses4
node = tree.add(packed=p, masklen=26)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
======================================================================
ERROR: test_15__packed_addresses6 (tests.test_regression.TestRadix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/py-radix-0.9.3/tests/test_regression.py", line 212, in test_15__packed_addresses6
node = tree.add(packed=p, masklen=108)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
----------------------------------------------------------------------
Ran 39 tests in 0.292s
FAILED (errors=2)
See https://docs.python.org/3.10/whatsnew/3.10.html#id2 https://bugs.python.org/issue40943
The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, U# and Z#. See Parsing arguments and building values and the PEP 353.