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
700be0ef
Commit
700be0ef
authored
Nov 23, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notes on migrating to a newer CFFI version and/or using it on CPython. [skip ci]
parent
faeecb66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
gevent/corecffi.py
gevent/corecffi.py
+22
-0
No files found.
gevent/corecffi.py
View file @
700be0ef
...
@@ -252,6 +252,7 @@ static void (*python_stop)(void* handle);
...
@@ -252,6 +252,7 @@ static void (*python_stop)(void* handle);
"""
"""
_cdef
+=
_cbs
_cdef
+=
_cbs
_source
+=
_cbs
_source
+=
_cbs
_watcher_type
=
None
for
_watcher_type
in
_watcher_types
:
for
_watcher_type
in
_watcher_types
:
_cdef
+=
"""
_cdef
+=
"""
...
@@ -305,6 +306,27 @@ for _watcher_type in _watcher_types:
...
@@ -305,6 +306,27 @@ for _watcher_type in _watcher_types:
thisdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
thisdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
include_dirs
=
[
thisdir
,
os
.
path
.
join
(
thisdir
,
'libev'
)]
include_dirs
=
[
thisdir
,
os
.
path
.
join
(
thisdir
,
'libev'
)]
#####
## XXX NOTE:
#
# In recent versions of CFFI on CPython, doing something like
# `libev._gevent_ev_io_callback` returns <built-in function
# _gevent_ev_io_callback> ("for performance"). These have the
# important property of not being able to pass them to any other libev
# functions without generating `TypeError: Expected cdata`.
# On PyPy, the same expression returns a cdata, and we rely on this below
# (see watcher._init_subclasses).
#
# The behaviour is the same though (they both return <built-in function>)
# when you use `ffi.set_source` instead of the deprecated `ffi.verify` function.
# In order to pass such attributes to other libev functions, you have to do
# `ffi.addressof(libev, '_gevent_ev_io_callback)`... Unfortunately, this fails
# when you use `ffi.verify`. So:
#
# - Using FFI on CPython cannot use ffi.verify();
# - Using set_source() and not verify() requires PyPy >= 2.6.0
# - Upgrading to set_source() will require moderate source changes;
#####
ffi
.
cdef
(
_cdef
)
ffi
.
cdef
(
_cdef
)
libev
=
C
=
ffi
.
verify
(
_source
,
include_dirs
=
include_dirs
)
libev
=
C
=
ffi
.
verify
(
_source
,
include_dirs
=
include_dirs
)
del
thisdir
,
include_dirs
,
_watcher_type
,
_watcher_types
del
thisdir
,
include_dirs
,
_watcher_type
,
_watcher_types
...
...
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