Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
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
shrapnel
Commits
8384e793
Commit
8384e793
authored
Jan 31, 2013
by
Sam Rushing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
string->bytes update
use cpython.bytes use libc.errno
parent
9bcdda93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
coro/aio.pyx
coro/aio.pyx
+9
-6
No files found.
coro/aio.pyx
View file @
8384e793
...
...
@@ -24,6 +24,9 @@ __aio_version__ = "$Id: //prod/main/ap/shrapnel/coro/aio.pyx#19 $"
# XXX todo - tests: coverage, performance, leak.
from
cpython.bytes
cimport
PyBytes_FromStringAndSize
,
PyBytes_Check
,
PyBytes_AS_STRING
from
libc
cimport
errno
cdef
extern
from
"signal.h"
:
cdef
union
sigval
:
...
...
@@ -69,16 +72,16 @@ cdef class aio_control_block:
self
.
cb
.
aio_offset
=
offset
self
.
cb
.
aio_sigevent
.
sigev_notify
=
SIGEV_KEVENT
self
.
cb
.
aio_sigevent
.
sigev_notify_kqueue
=
kq_fd
if
Py
String
_Check
(
str_or_size
):
if
Py
Bytes
_Check
(
str_or_size
):
self
.
buffer_string
=
str_or_size
self
.
cb
.
aio_buf
=
Py
String
_AS_STRING
(
str_or_size
)
self
.
cb
.
aio_nbytes
=
Py
String
_Size
(
str_or_size
)
self
.
cb
.
aio_buf
=
Py
Bytes
_AS_STRING
(
str_or_size
)
self
.
cb
.
aio_nbytes
=
Py
Bytes
_Size
(
str_or_size
)
elif
PyInt_Check
(
str_or_size
):
self
.
buffer_string
=
Py
String
_FromStringAndSize
(
NULL
,
str_or_size
)
self
.
cb
.
aio_buf
=
Py
String
_AS_STRING
(
self
.
buffer_string
)
self
.
buffer_string
=
Py
Bytes
_FromStringAndSize
(
NULL
,
str_or_size
)
self
.
cb
.
aio_buf
=
Py
Bytes
_AS_STRING
(
self
.
buffer_string
)
self
.
cb
.
aio_nbytes
=
str_or_size
else
:
raise
ValueError
,
"expected (int <kq_fd>, int <fd>, long <offset>,
string
|size <str_or_size>)"
raise
ValueError
,
"expected (int <kq_fd>, int <fd>, long <offset>,
bytes
|size <str_or_size>)"
def
__repr__
(
self
):
return
'<aiocb on fd=%d for %d bytes @ %r at 0x%x>'
%
(
...
...
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