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
bb77e1d2
Commit
bb77e1d2
authored
Jun 19, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stat watchers under Py3 by letting the path be the native str type
parent
9f56eed9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
gevent/core.ppyx
gevent/core.ppyx
+14
-4
greentest/test__core_stat.py
greentest/test__core_stat.py
+1
-1
known_failures.py
known_failures.py
+0
-1
No files found.
gevent/core.ppyx
View file @
bb77e1d2
...
...
@@ -496,7 +496,7 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
#endif
def stat(self,
bytes
path, float interval=0.0, ref=True, priority=None):
def stat(self,
str
path, float interval=0.0, ref=True, priority=None):
return stat(self, path, interval, ref, priority)
def run_callback(self, func, *args):
...
...
@@ -1036,11 +1036,21 @@ cdef public class child(watcher) [object PyGeventChildObject, type PyGeventChild
cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Type]:
WATCHER(stat)
cdef readonly bytes path
cdef readonly str path
cdef readonly bytes _paths
def __init__(self, loop loop,
bytes
path, float interval=0.0, ref=True, priority=None):
def __init__(self, loop loop,
str
path, float interval=0.0, ref=True, priority=None):
self.path = path
libev.ev_stat_init(&self._watcher, <void *>gevent_callback_stat, <char*>self.path, interval)
cdef bytes paths
if isinstance(path, unicode):
# the famous Python3 filesystem encoding debacle hits us here. Can we do better?
# We must keep a reference to the encoded string so that its bytes don't get freed
# and overwritten, leading to strange errors from libev ("no such file or directory")
paths = (<unicode>path).encode(sys.getfilesystemencoding())
self._paths = paths
else:
paths = <bytes>path
libev.ev_stat_init(&self._watcher, <void *>gevent_callback_stat, <char*>paths, interval)
self.loop = loop
if ref:
self._flags = 0
...
...
greentest/test__core_stat.py
View file @
bb77e1d2
...
...
@@ -19,7 +19,7 @@ try:
def
write
():
f
=
open
(
filename
,
'wb'
,
buffering
=
0
)
f
.
write
(
'x'
)
f
.
write
(
b
'x'
)
f
.
close
()
start
=
time
.
time
()
...
...
known_failures.py
View file @
bb77e1d2
...
...
@@ -85,7 +85,6 @@ test__refcount.py
test__all__.py
test__pywsgi.py
test__makefile_ref.py
test__core_stat.py
FLAKY test__greenio.py
FLAKY test__socket_dns.py
'''
.
strip
().
split
(
'
\
n
'
)
...
...
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