Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pytrap/src/unirecipaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ UnirecIPAddrRange_isIn(pytrap_unirecipaddrrange *self, PyObject *args)
PyObject *result = Py_False;

if (!PyObject_IsInstance(args, (PyObject *) &pytrap_UnirecIPAddr)) {
result = Py_NotImplemented;
PyErr_Format(PyExc_TypeError, "UnirecIPAddr object expected, got '%s'.", Py_TYPE(args)->tp_name);
return NULL;
}

int cmp_result;
Expand Down Expand Up @@ -520,7 +521,8 @@ UnirecIPAddrRange_isOverlap(pytrap_unirecipaddrrange *self, PyObject *args)
return NULL;

if (!PyObject_IsInstance((PyObject*)other, (PyObject *) &pytrap_UnirecIPAddrRange)) {
return Py_NotImplemented;
PyErr_Format(PyExc_TypeError, "UnirecIPAddrRange object expected, got '%s'.", Py_TYPE(other)->tp_name);
return NULL;
}

tmp = UnirecIPAddrRange_isIn(self, (PyObject *) other->start);
Expand All @@ -537,6 +539,11 @@ UnirecIPAddrRange_isOverlap(pytrap_unirecipaddrrange *self, PyObject *args)
static int
UnirecIPAddrRange_contains(pytrap_unirecipaddrrange *o, pytrap_unirecipaddr *ip)
{
if (!PyObject_IsInstance((PyObject *) ip, (PyObject *) &pytrap_UnirecIPAddr)) {
PyErr_Format(PyExc_TypeError, "UnirecIPAddr object expected, got '%s'.", Py_TYPE(ip)->tp_name);
return -1;
}

PyObject * tmp = UnirecIPAddrRange_isIn(o, (PyObject *) ip);
int cmp_result = PyLong_AsLong(tmp);
Py_DECREF(tmp);
Expand Down