Commit 11fb2737 authored by Denis Bilenko's avatar Denis Bilenko

fix build problem on python2.5

parent fad78acb
......@@ -50,17 +50,20 @@ cdef extern from "sys/types.h":
ctypedef unsigned char u_char
cdef extern from "Python.h":
void Py_INCREF(void* o)
void Py_DECREF(void* o)
void Py_XDECREF(void* o)
object PyString_FromStringAndSize(char *v, int len)
object PyString_FromString(char *v)
struct PyObject:
pass
ctypedef PyObject* PyObjectPtr "PyObject*"
void Py_INCREF(PyObjectPtr o)
void Py_DECREF(PyObjectPtr o)
void Py_XDECREF(PyObjectPtr o)
object PyString_FromStringAndSize(char *v, int len)
object PyString_FromString(char *v)
cdef extern from "frameobject.h":
ctypedef struct PyThreadState:
void* exc_type
void* exc_value
void* exc_traceback
PyObjectPtr exc_type
PyObjectPtr exc_value
PyObjectPtr exc_traceback
PyThreadState* PyThreadState_GET()
......@@ -164,12 +167,12 @@ cdef class event:
cdef _addref(self):
if self._incref <= 0:
Py_INCREF(<void*>self)
Py_INCREF(<PyObjectPtr>self)
self._incref += 1
cdef _delref(self):
if self._incref > 0:
Py_DECREF(<void*>self)
Py_DECREF(<PyObjectPtr>self)
self._incref -= 1
property pending:
......@@ -469,8 +472,8 @@ def set_exc_info(object type, object value):
tstate.exc_type = NULL
tstate.exc_value = NULL
else:
Py_INCREF(<void*>type)
Py_INCREF(<void*>value)
tstate.exc_type = <void*>type
tstate.exc_value = <void *>value
Py_INCREF(<PyObjectPtr>type)
Py_INCREF(<PyObjectPtr>value)
tstate.exc_type = <PyObjectPtr>type
tstate.exc_value = <PyObjectPtr>value
tstate.exc_traceback = NULL
......@@ -56,7 +56,7 @@ def dns_err_to_string(int err):
cdef void __evdns_callback(int code, char type, int count, int ttl, void *addrs, void *arg) with gil:
cdef int i
cdef object callback = <object>arg
Py_DECREF(<void*>callback)
Py_DECREF(<PyObjectPtr>callback)
cdef object addr
cdef object result
......@@ -91,7 +91,7 @@ def dns_resolve_ipv4(char *name, int flags, object callback):
cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, <void *>callback)
if result:
raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, result, ))
Py_INCREF(<void*>callback)
Py_INCREF(<PyObjectPtr>callback)
def dns_resolve_ipv6(char *name, int flags, object callback):
......@@ -104,7 +104,7 @@ def dns_resolve_ipv6(char *name, int flags, object callback):
cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, <void *>callback)
if result:
raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, result, ))
Py_INCREF(<void*>callback)
Py_INCREF(<PyObjectPtr>callback)
def dns_resolve_reverse(char* packed_ip, int flags, object callback):
......@@ -117,7 +117,7 @@ def dns_resolve_reverse(char* packed_ip, int flags, object callback):
cdef int result = evdns_resolve_reverse(<void *>packed_ip, flags, __evdns_callback, <void *>callback)
if result:
raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, result, ))
Py_INCREF(<void*>callback)
Py_INCREF(<PyObjectPtr>callback)
def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback):
......@@ -130,4 +130,4 @@ def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback):
cdef int result = evdns_resolve_reverse_ipv6(<void *>packed_ip, flags, __evdns_callback, <void *>callback)
if result:
raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, ))
Py_INCREF(<void*>callback)
Py_INCREF(<PyObjectPtr>callback)
......@@ -485,12 +485,12 @@ cdef class http_request_client(http_request_base):
cdef _addref(self):
if self._incref <= 0:
Py_INCREF(<void*>self)
Py_INCREF(<PyObjectPtr>self)
self._incref += 1
cdef _delref(self):
if self._incref > 0:
Py_DECREF(<void*>self)
Py_DECREF(<PyObjectPtr>self)
self._incref -= 1
self.callback = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment