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
8bc7a49f
Commit
8bc7a49f
authored
Aug 01, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loop: check argument for sanity
parent
8e7cea04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
gevent/core_.pyx
gevent/core_.pyx
+19
-0
No files found.
gevent/core_.pyx
View file @
8bc7a49f
...
...
@@ -168,6 +168,24 @@ cpdef unsigned int _flags_to_int(object flags) except? -1:
return
result
cdef
str
_str_hex
(
object
flag
):
if
isinstance
(
flag
,
(
int
,
long
)):
return
hex
(
flag
)
return
str
(
flag
)
cpdef
_check_flags
(
unsigned
int
flags
):
cdef
list
as_list
flags
&=
libev
.
EVBACKEND_MASK
if
not
flags
:
return
if
not
(
flags
&
libev
.
EVBACKEND_ALL
):
raise
ValueError
(
'Invalid value for backend: 0x%x'
%
flags
)
if
not
(
flags
&
libev
.
ev_supported_backends
()):
as_list
=
[
_str_hex
(
x
)
for
x
in
_flags_to_list
(
flags
)]
raise
ValueError
(
'Unsupported backend: %s'
%
'|'
.
join
(
as_list
))
cpdef
_events_to_str
(
int
events
):
cdef
list
result
=
[]
cdef
int
c_flag
...
...
@@ -215,6 +233,7 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
self
.
_ptr
=
<
libev
.
ev_loop
*>
ptr
else
:
c_flags
=
_flags_to_int
(
flags
)
_check_flags
(
c_flags
)
if
default
:
self
.
_ptr
=
libev
.
ev_default_loop
(
c_flags
)
if
not
self
.
_ptr
:
...
...
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