@@ -480,7 +480,8 @@ UnirecIPAddrRange_isIn(pytrap_unirecipaddrrange *self, PyObject *args)
480480 PyObject * result = Py_False ;
481481
482482 if (!PyObject_IsInstance (args , (PyObject * ) & pytrap_UnirecIPAddr )) {
483- result = Py_NotImplemented ;
483+ PyErr_Format (PyExc_TypeError , "UnirecIPAddr object expected, got '%s'." , Py_TYPE (args )-> tp_name );
484+ return NULL ;
484485 }
485486
486487 int cmp_result ;
@@ -520,7 +521,8 @@ UnirecIPAddrRange_isOverlap(pytrap_unirecipaddrrange *self, PyObject *args)
520521 return NULL ;
521522
522523 if (!PyObject_IsInstance ((PyObject * )other , (PyObject * ) & pytrap_UnirecIPAddrRange )) {
523- return Py_NotImplemented ;
524+ PyErr_Format (PyExc_TypeError , "UnirecIPAddrRange object expected, got '%s'." , Py_TYPE (other )-> tp_name );
525+ return NULL ;
524526 }
525527
526528 tmp = UnirecIPAddrRange_isIn (self , (PyObject * ) other -> start );
@@ -537,6 +539,11 @@ UnirecIPAddrRange_isOverlap(pytrap_unirecipaddrrange *self, PyObject *args)
537539static int
538540UnirecIPAddrRange_contains (pytrap_unirecipaddrrange * o , pytrap_unirecipaddr * ip )
539541{
542+ if (!PyObject_IsInstance ((PyObject * ) ip , (PyObject * ) & pytrap_UnirecIPAddr )) {
543+ PyErr_Format (PyExc_TypeError , "UnirecIPAddr object expected, got '%s'." , Py_TYPE (ip )-> tp_name );
544+ return -1 ;
545+ }
546+
540547 PyObject * tmp = UnirecIPAddrRange_isIn (o , (PyObject * ) ip );
541548 int cmp_result = PyLong_AsLong (tmp );
542549 Py_DECREF (tmp );
0 commit comments