mjschultz/py-radix

Optional args/kwargs are handled incorrectly

SantjagoCorkez opened this issue · 2 comments

All those methods with network=None, masklen=None, packed=None signature are improperly handled via C-ext.

While parsing args/kwargs with PyArg_ParseTupleAndKeywords() declaring arg/kwarg's signature with s leads to fill the value with Py_None object while the arg was explicitly passed as None from python. This could be eliminated declaring an arg/kwarg with z - that leads a NULL value in C code instead of Py_None

I've prepared a PR #31

Also a case that shows the bug:

tr = radix.Radix()
tr.add('127.0.0.1', 8, None)  # causes TypeError of packed parameter (not bytes-like)

Should be available via pip install py-radix==0.10.0