ident.pyx, defs.pxi: Use Pyrex `typecheck' for type checking.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 27 Jul 2017 09:49:59 +0000 (10:49 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 16 Aug 2017 03:31:32 +0000 (04:31 +0100)
Throw away the previous kludgy hacking with `PyObject_TypeCheck'.

defs.pxi
ident.pyx

index bfb4dcc..cec2d86 100644 (file)
--- a/defs.pxi
+++ b/defs.pxi
@@ -98,7 +98,6 @@ cdef extern from 'Python.h':
   object PyString_FromStringAndSize(char *p, Py_ssize_t len)
   int PyString_AsStringAndSize(obj, char **p, Py_ssize_t *len) except -1
   int PyObject_AsReadBuffer(obj, void **buf, Py_ssize_t *len) except -1
-  int PyObject_TypeCheck(obj, ty)
   object PyInt_FromLong(long i)
   object PyLong_FromUnsignedLong(unsigned long i)
   char *PyString_AS_STRING(string)
index 90d8f0f..7ea6b45 100644 (file)
--- a/ident.pyx
+++ b/ident.pyx
@@ -57,7 +57,7 @@ cdef class SelIdentify:
     cdef sockaddr_in s_in, s_out
     cdef socklen_t sz_in, sz_out
     cdef int fd
-    if PyObject_TypeCheck(sk, socket.SocketType):
+    if typecheck(sk, socket.SocketType):
       fd = sk.fileno()
       sz_in = PSIZEOF(&s_in)
       sz_out = PSIZEOF(&s_out)