Commit 2edfdccb authored by Denis Bilenko's avatar Denis Bilenko

core_.pyx: use <void*> instead of <object>, because cython 0.14.1 will add...

core_.pyx: use <void*> instead of <object>, because cython 0.14.1 will add additional incref/decref for <object> arguments
parent 2d37df7b
...@@ -11,10 +11,10 @@ __all__ = ['get_version', ...@@ -11,10 +11,10 @@ __all__ = ['get_version',
cdef extern from "Python.h": cdef extern from "Python.h":
void Py_INCREF(object o) void Py_INCREF(void* o)
void Py_DECREF(object o) void Py_DECREF(void* o)
int Py_ReprEnter(object o) int Py_ReprEnter(void* o)
void Py_ReprLeave(object o) void Py_ReprLeave(void* o)
cdef extern from "frameobject.h": cdef extern from "frameobject.h":
ctypedef struct PyThreadState: ctypedef struct PyThreadState:
...@@ -359,7 +359,7 @@ cdef class loop: ...@@ -359,7 +359,7 @@ cdef class loop:
define(INCREF, ``if self._incref == 1: define(INCREF, ``if self._incref == 1:
self._incref = 2 self._incref = 2
Py_INCREF(self)'') Py_INCREF(<void*>self)'')
define(WATCHER_BASE, `cdef public loop loop define(WATCHER_BASE, `cdef public loop loop
...@@ -373,7 +373,7 @@ define(WATCHER_BASE, `cdef public loop loop ...@@ -373,7 +373,7 @@ define(WATCHER_BASE, `cdef public loop loop
self.callback = None self.callback = None
self.args = None self.args = None
if self._incref == 2: if self._incref == 2:
Py_DECREF(self) Py_DECREF(<void*>self)
self._incref = 1 self._incref = 1
def __dealloc__(self): def __dealloc__(self):
...@@ -434,7 +434,7 @@ cdef class watcher: ...@@ -434,7 +434,7 @@ cdef class watcher:
"""Abstract base class for all the watchers""" """Abstract base class for all the watchers"""
def __repr__(self): def __repr__(self):
if Py_ReprEnter(self) != 0: if Py_ReprEnter(<void*>self) != 0:
return "<...>" return "<...>"
try: try:
format = self._format() format = self._format()
...@@ -455,7 +455,7 @@ cdef class watcher: ...@@ -455,7 +455,7 @@ cdef class watcher:
result += " _incref=%s" % self._incref result += " _incref=%s" % self._incref
return result + ">" return result + ">"
finally: finally:
Py_ReprLeave(self) Py_ReprLeave(<void*>self)
def _format(self): def _format(self):
return '' return ''
...@@ -576,17 +576,17 @@ cdef class callback(watcher): ...@@ -576,17 +576,17 @@ cdef class callback(watcher):
def set_exc_info(object type, object value): def set_exc_info(object type, object value):
cdef PyThreadState* tstate = PyThreadState_GET() cdef PyThreadState* tstate = PyThreadState_GET()
if tstate.exc_type != NULL: if tstate.exc_type != NULL:
Py_DECREF(<object>tstate.exc_type) Py_DECREF(<void*>tstate.exc_type)
if tstate.exc_value != NULL: if tstate.exc_value != NULL:
Py_DECREF(<object>tstate.exc_value) Py_DECREF(<void*>tstate.exc_value)
if tstate.exc_traceback != NULL: if tstate.exc_traceback != NULL:
Py_DECREF(<object>tstate.exc_traceback) Py_DECREF(<void*>tstate.exc_traceback)
if value is None: if value is None:
tstate.exc_type = NULL tstate.exc_type = NULL
tstate.exc_value = NULL tstate.exc_value = NULL
else: else:
Py_INCREF(type) Py_INCREF(<void*>type)
Py_INCREF(value) Py_INCREF(<void*>value)
tstate.exc_type = <void*>type tstate.exc_type = <void*>type
tstate.exc_value = <void *>value tstate.exc_value = <void *>value
tstate.exc_traceback = NULL tstate.exc_traceback = NULL
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