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

DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats #54

Open
robertoberto opened this issue Jul 8, 2021 · 1 comment · May be fixed by #55
Open

DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats #54

robertoberto opened this issue Jul 8, 2021 · 1 comment · May be fixed by #55

Comments

@robertoberto
Copy link

    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)

@hroncok
Copy link

hroncok commented Aug 23, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants