From 741f7410ed5c67e4a2641925bd22eb71c85a39cf Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 27 Jul 2017 10:49:59 +0100 Subject: [PATCH] ident.pyx, defs.pxi: Use Pyrex `typecheck' for type checking. Throw away the previous kludgy hacking with `PyObject_TypeCheck'. --- defs.pxi | 1 - ident.pyx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/defs.pxi b/defs.pxi index bfb4dcc..cec2d86 100644 --- 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) diff --git a/ident.pyx b/ident.pyx index 90d8f0f..7ea6b45 100644 --- 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) -- 2.11.0