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
4020a482
Commit
4020a482
authored
Aug 29, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename os_read/os_write/os_fork into _read/_write/_fork
parent
01a8a2a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
gevent/fileobject.py
gevent/fileobject.py
+3
-3
gevent/os.py
gevent/os.py
+8
-8
No files found.
gevent/fileobject.py
View file @
4020a482
...
...
@@ -3,7 +3,7 @@ import sys
import
os
from
gevent.hub
import
get_hub
from
gevent.socket
import
EBADF
from
gevent.os
import
os_read
,
os
_write
,
ignored_errors
from
gevent.os
import
_read
,
_write
,
ignored_errors
try
:
...
...
@@ -98,7 +98,7 @@ else:
bytes_written
=
0
while
bytes_written
<
bytes_total
:
try
:
bytes_written
+=
os
_write
(
fileno
,
_get_memory
(
data
,
bytes_written
))
bytes_written
+=
_write
(
fileno
,
_get_memory
(
data
,
bytes_written
))
except
(
IOError
,
OSError
):
code
=
sys
.
exc_info
()[
1
].
args
[
0
]
if
code
not
in
ignored_errors
:
...
...
@@ -109,7 +109,7 @@ else:
def
recv
(
self
,
size
):
while
True
:
try
:
data
=
os
_read
(
self
.
fileno
(),
size
)
data
=
_read
(
self
.
fileno
(),
size
)
except
(
IOError
,
OSError
):
code
=
sys
.
exc_info
()[
1
].
args
[
0
]
if
code
in
ignored_errors
:
...
...
gevent/os.py
View file @
4020a482
...
...
@@ -22,9 +22,9 @@ except ImportError:
__implements__
=
[
'read'
,
'write'
,
'fork'
]
__all__
=
__implements__
os
_read
=
os
.
read
os
_write
=
os
.
write
os
_fork
=
os
.
fork
_read
=
os
.
read
_write
=
os
.
write
_fork
=
os
.
fork
ignored_errors
=
[
EAGAIN
,
errno
.
EINTR
]
...
...
@@ -58,7 +58,7 @@ def posix_read(fd, n):
if
not
flags
&
os
.
O_NONBLOCK
:
_map_errors
(
fcntl
.
fcntl
,
fd
,
fcntl
.
F_SETFL
,
flags
|
os
.
O_NONBLOCK
)
try
:
return
os
_read
(
fd
,
n
)
return
_read
(
fd
,
n
)
except
OSError
,
e
:
if
e
.
errno
not
in
ignored_errors
:
raise
...
...
@@ -86,7 +86,7 @@ def posix_write(fd, buf):
if
not
flags
&
os
.
O_NONBLOCK
:
_map_errors
(
fcntl
.
fcntl
,
fd
,
fcntl
.
F_SETFL
,
flags
|
os
.
O_NONBLOCK
)
try
:
return
os
_write
(
fd
,
buf
)
return
_write
(
fd
,
buf
)
except
OSError
,
e
:
if
e
.
errno
not
in
ignored_errors
:
raise
...
...
@@ -105,13 +105,13 @@ def threadpool_read(fd, n):
"""Read up to `n` bytes from file descriptor `fd`. Return a string
containing the bytes read. If end-of-file is reached, an empty string
is returned."""
return
get_hub
().
threadpool
.
apply
(
os
_read
,
(
fd
,
n
))
return
get_hub
().
threadpool
.
apply
(
_read
,
(
fd
,
n
))
def
threadpool_write
(
fd
,
buf
):
"""Write bytes from buffer `buf` to file descriptor `fd`. Return the
number of bytes written."""
return
get_hub
().
threadpool
.
apply
(
os
_write
,
(
fd
,
buf
))
return
get_hub
().
threadpool
.
apply
(
_write
,
(
fd
,
buf
))
if
fcntl
is
None
:
...
...
@@ -125,7 +125,7 @@ else:
if
hasattr
(
os
,
'fork'
):
def
fork
():
result
=
os
_fork
()
result
=
_fork
()
if
not
result
:
reinit
()
return
result
...
...
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