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": ...@@ -50,17 +50,20 @@ cdef extern from "sys/types.h":
ctypedef unsigned char u_char ctypedef unsigned char u_char
cdef extern from "Python.h": cdef extern from "Python.h":
void Py_INCREF(void* o) struct PyObject:
void Py_DECREF(void* o) pass
void Py_XDECREF(void* o) ctypedef PyObject* PyObjectPtr "PyObject*"
object PyString_FromStringAndSize(char *v, int len) void Py_INCREF(PyObjectPtr o)
object PyString_FromString(char *v) 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": cdef extern from "frameobject.h":
ctypedef struct PyThreadState: ctypedef struct PyThreadState:
void* exc_type PyObjectPtr exc_type
void* exc_value PyObjectPtr exc_value
void* exc_traceback PyObjectPtr exc_traceback
PyThreadState* PyThreadState_GET() PyThreadState* PyThreadState_GET()
...@@ -164,12 +167,12 @@ cdef class event: ...@@ -164,12 +167,12 @@ cdef class event:
cdef _addref(self): cdef _addref(self):
if self._incref <= 0: if self._incref <= 0:
Py_INCREF(<void*>self) Py_INCREF(<PyObjectPtr>self)
self._incref += 1 self._incref += 1
cdef _delref(self): cdef _delref(self):
if self._incref > 0: if self._incref > 0:
Py_DECREF(<void*>self) Py_DECREF(<PyObjectPtr>self)
self._incref -= 1 self._incref -= 1
property pending: property pending:
...@@ -469,8 +472,8 @@ def set_exc_info(object type, object value): ...@@ -469,8 +472,8 @@ def set_exc_info(object type, object value):
tstate.exc_type = NULL tstate.exc_type = NULL
tstate.exc_value = NULL tstate.exc_value = NULL
else: else:
Py_INCREF(<void*>type) Py_INCREF(<PyObjectPtr>type)
Py_INCREF(<void*>value) Py_INCREF(<PyObjectPtr>value)
tstate.exc_type = <void*>type tstate.exc_type = <PyObjectPtr>type
tstate.exc_value = <void *>value tstate.exc_value = <PyObjectPtr>value
tstate.exc_traceback = NULL tstate.exc_traceback = NULL
...@@ -56,7 +56,7 @@ def dns_err_to_string(int err): ...@@ -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 void __evdns_callback(int code, char type, int count, int ttl, void *addrs, void *arg) with gil:
cdef int i cdef int i
cdef object callback = <object>arg cdef object callback = <object>arg
Py_DECREF(<void*>callback) Py_DECREF(<PyObjectPtr>callback)
cdef object addr cdef object addr
cdef object result cdef object result
...@@ -91,7 +91,7 @@ def dns_resolve_ipv4(char *name, int flags, object callback): ...@@ -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) cdef int result = evdns_resolve_ipv4(name, flags, __evdns_callback, <void *>callback)
if result: if result:
raise IOError('evdns_resolve_ipv4(%r, %r) returned %s' % (name, flags, 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): def dns_resolve_ipv6(char *name, int flags, object callback):
...@@ -104,7 +104,7 @@ 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) cdef int result = evdns_resolve_ipv6(name, flags, __evdns_callback, <void *>callback)
if result: if result:
raise IOError('evdns_resolve_ip6(%r, %r) returned %s' % (name, flags, 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): 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): ...@@ -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) cdef int result = evdns_resolve_reverse(<void *>packed_ip, flags, __evdns_callback, <void *>callback)
if result: if result:
raise IOError('evdns_resolve_reverse(%r, %r) returned %s' % (packed_ip, flags, 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): 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): ...@@ -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) cdef int result = evdns_resolve_reverse_ipv6(<void *>packed_ip, flags, __evdns_callback, <void *>callback)
if result: if result:
raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, 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): ...@@ -485,12 +485,12 @@ cdef class http_request_client(http_request_base):
cdef _addref(self): cdef _addref(self):
if self._incref <= 0: if self._incref <= 0:
Py_INCREF(<void*>self) Py_INCREF(<PyObjectPtr>self)
self._incref += 1 self._incref += 1
cdef _delref(self): cdef _delref(self):
if self._incref > 0: if self._incref > 0:
Py_DECREF(<void*>self) Py_DECREF(<PyObjectPtr>self)
self._incref -= 1 self._incref -= 1
self.callback = None 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