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
546c5218
Commit
546c5218
authored
Apr 16, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement stat watchers on PyPy.
parent
9661f035
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
gevent/corecffi.py
gevent/corecffi.py
+41
-0
known_failures.py
known_failures.py
+0
-3
No files found.
gevent/corecffi.py
View file @
546c5218
...
@@ -114,6 +114,7 @@ struct stat {
...
@@ -114,6 +114,7 @@ struct stat {
struct ev_stat {
struct ev_stat {
struct stat attr;
struct stat attr;
const char* path;
struct stat prev;
struct stat prev;
double interval;
double interval;
...;
...;
...
@@ -648,6 +649,9 @@ class loop(object):
...
@@ -648,6 +649,9 @@ class loop(object):
def
install_sigchld
(
self
):
def
install_sigchld
(
self
):
libev
.
gevent_install_sigchld_handler
()
libev
.
gevent_install_sigchld_handler
()
def
stat
(
self
,
path
,
interval
=
0.0
,
ref
=
True
,
priority
=
None
):
return
stat
(
self
,
path
,
interval
,
ref
,
priority
)
def
callback
(
self
,
priority
=
None
):
def
callback
(
self
,
priority
=
None
):
return
callback
(
self
,
priority
)
return
callback
(
self
,
priority
)
...
@@ -1054,6 +1058,43 @@ class child(watcher):
...
@@ -1054,6 +1058,43 @@ class child(watcher):
def
rstatus
(
self
,
value
):
def
rstatus
(
self
,
value
):
self
.
_watcher
.
rstatus
=
value
self
.
_watcher
.
rstatus
=
value
class
stat
(
watcher
):
_watcher_start
=
libev
.
ev_stat_start
_watcher_stop
=
libev
.
ev_stat_stop
_watcher_init
=
libev
.
ev_stat_init
_watcher_type
=
'ev_stat'
_watcher_ffi_type
=
"struct %s *"
%
_watcher_type
_watcher_ffi_cb
=
"void(*)(struct ev_loop *, struct %s *, int)"
%
_watcher_type
def
__init__
(
self
,
_loop
,
path
,
interval
=
0.0
,
ref
=
True
,
priority
=
None
):
self
.
path
=
path
watcher
.
__init__
(
self
,
_loop
,
ref
=
ref
,
priority
=
priority
,
args
=
(
path
,
interval
))
# XXX: self._watcher.path is not getting properly set at the C level
# (Possibly because ev_stat_init is actually a macro? I don't know)
# Something overwrites it or fails to set it. We reset it in start() method
def
start
(
self
,
callback
,
*
args
):
self
.
_watcher
.
path
=
ffi
.
new
(
"char[]"
,
self
.
path
)
watcher
.
start
(
self
,
callback
,
*
args
)
def
stop
(
self
):
watcher
.
stop
(
self
)
@
property
def
attr
(
self
):
if
not
self
.
_watcher
.
attr
.
st_nlink
:
return
return
self
.
_watcher
.
attr
@
property
def
prev
(
self
):
if
not
self
.
_watcher
.
prev
.
st_nlink
:
return
return
self
.
_watcher
.
prev
@
property
def
interval
(
self
):
return
self
.
_watcher
.
interval
def
_syserr_cb
(
msg
):
def
_syserr_cb
(
msg
):
try
:
try
:
...
...
known_failures.py
View file @
546c5218
...
@@ -58,9 +58,6 @@ if PYPY:
...
@@ -58,9 +58,6 @@ if PYPY:
FAILING_TESTS
+=
[
FAILING_TESTS
+=
[
# Not implemented:
# Not implemented:
# stat watchers are not implemented on pypy
'test__core_stat.py'
,
# ares not supported on PyPy yet
# ares not supported on PyPy yet
'test__ares_host_result.py'
,
'test__ares_host_result.py'
,
...
...
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