Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
494204d1
Commit
494204d1
authored
Apr 22, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix build problem on Python 2.5
parent
f0a41580
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
28 deletions
+31
-28
gevent/callbacks.c
gevent/callbacks.c
+2
-2
gevent/cares.pxi
gevent/cares.pxi
+5
-5
gevent/core_.pyx
gevent/core_.pyx
+24
-21
No files found.
gevent/callbacks.c
View file @
494204d1
...
...
@@ -80,7 +80,7 @@ static void gevent_callback(struct ev_loop *_loop, void *c_watcher, int revents)
/* we use this callback for all watchers, not just timer
* we can do this, because layout of struct members is the same for all watchers */
watcher
=
((
struct
PyGeventTimerObject
*
)(((
char
*
)
c_watcher
)
-
timer_offsetof
));
Py_INCREF
(
watcher
);
Py_INCREF
(
(
PyObject
*
)
watcher
);
gevent_check_signals
(
watcher
->
loop
);
args
=
watcher
->
args
;
if
(
args
==
Py_None
)
{
...
...
@@ -126,7 +126,7 @@ static void gevent_callback(struct ev_loop *_loop, void *c_watcher, int revents)
gevent_stop
(
watcher
);
}
end:
Py_DECREF
(
watcher
);
Py_DECREF
(
(
PyObject
*
)
watcher
);
GIL_RELEASE
;
}
...
...
gevent/cares.pxi
View file @
494204d1
...
...
@@ -175,7 +175,7 @@ cdef void gevent_ares_host_callback(void *arg, int status, int timeouts, hostent
cdef
ares_channel
channel
cdef
object
callback
channel
,
callback
=
<
tuple
>
arg
Py_DECREF
(
arg
)
Py_DECREF
(
<
PyObjectPtr
>
arg
)
cdef
object
host_result
try
:
if
status
or
not
host
:
...
...
@@ -195,7 +195,7 @@ cdef void gevent_ares_nameinfo_callback(void *arg, int status, int timeouts, cha
cdef
ares_channel
channel
cdef
object
callback
channel
,
callback
=
<
tuple
>
arg
Py_DECREF
(
arg
)
Py_DECREF
(
<
PyObjectPtr
>
arg
)
cdef
object
node
cdef
object
service
try
:
...
...
@@ -358,7 +358,7 @@ cdef public class ares_channel [object PyGeventAresChannelObject, type PyGeventA
# behaves the same as AS_UNSPEC
# note that for file lookups still AF_INET can be returned for AF_INET6 request
cdef
object
arg
=
(
self
,
callback
)
Py_INCREF
(
<
void
*
>
arg
)
Py_INCREF
(
<
PyObjectPtr
>
arg
)
cares
.
ares_gethostbyname
(
self
.
channel
,
name
,
family
,
<
void
*>
gevent_ares_host_callback
,
<
void
*>
arg
)
def
gethostbyaddr
(
self
,
object
callback
,
char
*
addr
):
...
...
@@ -378,7 +378,7 @@ cdef public class ares_channel [object PyGeventAresChannelObject, type PyGeventA
callback
(
result
(
exception
=
ValueError
(
'illegal IP address string: %r'
%
addr
)))
return
cdef
object
arg
=
(
self
,
callback
)
Py_INCREF
(
<
void
*
>
arg
)
Py_INCREF
(
<
PyObjectPtr
>
arg
)
cares
.
ares_gethostbyaddr
(
self
.
channel
,
addr_packed
,
length
,
family
,
<
void
*>
gevent_ares_host_callback
,
<
void
*>
arg
)
cpdef
_getnameinfo
(
self
,
object
callback
,
tuple
sockaddr
,
int
flags
):
...
...
@@ -400,7 +400,7 @@ cdef public class ares_channel [object PyGeventAresChannelObject, type PyGeventA
callback
(
result
(
exception
=
ValueError
(
'illegal IP address string: %r'
%
hostp
)))
return
cdef
object
arg
=
(
self
,
callback
)
Py_INCREF
(
<
void
*
>
arg
)
Py_INCREF
(
<
PyObjectPtr
>
arg
)
cares
.
ares_getnameinfo
(
self
.
channel
,
&
sa6
,
length
,
flags
,
<
void
*>
gevent_ares_nameinfo_callback
,
<
void
*>
arg
)
def
getnameinfo
(
self
,
object
callback
,
tuple
sockaddr
,
int
flags
):
...
...
gevent/core_.pyx
View file @
494204d1
...
...
@@ -13,18 +13,21 @@ __all__ = ['get_version',
cdef
extern
from
"Python.h"
:
void
Py_INCREF
(
void
*
)
void
Py_DECREF
(
void
*
)
void
Py_XDECREF
(
void
*
)
int
Py_ReprEnter
(
void
*
)
void
Py_ReprLeave
(
void
*
)
int
PyCallable_Check
(
void
*
)
struct
PyObject
:
pass
ctypedef
PyObject
*
PyObjectPtr
"PyObject*"
void
Py_INCREF
(
PyObjectPtr
)
void
Py_DECREF
(
PyObjectPtr
)
void
Py_XDECREF
(
PyObjectPtr
)
int
Py_ReprEnter
(
PyObjectPtr
)
void
Py_ReprLeave
(
PyObjectPtr
)
int
PyCallable_Check
(
PyObjectPtr
)
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
()
cdef
extern
from
"callbacks.h"
:
...
...
@@ -370,7 +373,7 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
define
(
INCREF
,
``
if
self
.
_incref
==
0
:
self
.
_incref
=
1
Py_INCREF
(
<
void
*
>
self
)
''
)
Py_INCREF
(
<
PyObjectPtr
>
self
)
''
)
define
(
WATCHER_BASE
,
`
cdef
public
loop
loop
...
...
@@ -385,7 +388,7 @@ define(WATCHER_BASE, `cdef public loop loop
return
self
.
_callback
def
__set__
(
self
,
object
callback
):
if
not
PyCallable_Check
(
<
void
*
>
callback
):
if
not
PyCallable_Check
(
<
PyObjectPtr
>
callback
):
raise
TypeError
(
"Expected callable, not %r"
%
callback
)
self
.
_callback
=
callback
...
...
@@ -397,7 +400,7 @@ define(WATCHER_BASE, `cdef public loop loop
self
.
_callback
=
None
self
.
args
=
None
if
self
.
_incref
==
1
:
Py_DECREF
(
<
void
*
>
self
)
Py_DECREF
(
<
PyObjectPtr
>
self
)
self
.
_incref
=
0
property
pending
:
...
...
@@ -464,7 +467,7 @@ cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Ty
"""Abstract base class for all the watchers"""
def __repr__(self):
if Py_ReprEnter(<
void*
>self) != 0:
if Py_ReprEnter(<
PyObjectPtr
>self) != 0:
return "<...>"
try:
format = self._format()
...
...
@@ -483,7 +486,7 @@ cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Ty
result += " _incref=%s" % self._incref
return result + ">"
finally:
Py_ReprLeave(<
void*
>self)
Py_ReprLeave(<
PyObjectPtr
>self)
def _format(self):
return ''
...
...
@@ -613,19 +616,19 @@ cdef public class callback(watcher) [object PyGeventCallbackObject, type PyGeven
def set_exc_info(object type, object value):
cdef PyThreadState* tstate = PyThreadState_GET()
Py_XDECREF(
<void*>
tstate.exc_type)
Py_XDECREF(
<void*>
tstate.exc_value)
Py_XDECREF(
<void*>
tstate.exc_traceback)
Py_XDECREF(tstate.exc_type)
Py_XDECREF(tstate.exc_value)
Py_XDECREF(tstate.exc_traceback)
if type is None:
tstate.exc_type = NULL
else:
Py_INCREF(<
void*
>type)
tstate.exc_type = <
void*
>type
Py_INCREF(<
PyObjectPtr
>type)
tstate.exc_type = <
PyObjectPtr
>type
if value is None:
tstate.exc_value = NULL
else:
Py_INCREF(<
void*
>value)
tstate.exc_value = <
void *
>value
Py_INCREF(<
PyObjectPtr
>value)
tstate.exc_value = <
PyObjectPtr
>value
tstate.exc_traceback = NULL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment