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
35286088
Commit
35286088
authored
Mar 27, 2019
by
Jason Madden
Committed by
GitHub
Mar 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1376 from gevent/issue1372
libev-cffi: Use nlink_t and let the compiler fill in the definition.
parents
1f8b3fa2
18d198a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
36 deletions
+35
-36
CHANGES.rst
CHANGES.rst
+4
-0
setup.py
setup.py
+1
-0
src/gevent/libev/_corecffi_build.py
src/gevent/libev/_corecffi_build.py
+7
-15
src/gevent/libev/_corecffi_source.c
src/gevent/libev/_corecffi_source.c
+3
-3
src/gevent/libuv/_corecffi_build.py
src/gevent/libuv/_corecffi_build.py
+12
-17
src/gevent/testing/testrunner.py
src/gevent/testing/testrunner.py
+8
-1
No files found.
CHANGES.rst
View file @
35286088
...
...
@@ -44,6 +44,10 @@
- Avoid unbounded memory usage when creating very deep spawn trees.
Reported in :issue:`1371` by dmrlawson.
- libev-cffi: Let the compiler fill in the definition of ``nlink_t`` for
``st_nlink`` in ``struct stat``, instead of trying to guess it
ourself. Reported in :issue:`1372` by Andreas Schwab.
1.4.0 (2019-01-04)
==================
...
...
setup.py
View file @
35286088
...
...
@@ -187,6 +187,7 @@ if not WIN:
# Python API functions, and you're not supposed to do that from
# CFFI code. Plus I could never get the libraries= line to ffi.compile()
# correct to make linking work.
# Also, we use the type `nlink_t`, which is not defined on Windows.
cffi_modules
.
append
(
LIBEV_CFFI_MODULE
)
...
...
src/gevent/libev/_corecffi_build.py
View file @
35286088
...
...
@@ -10,21 +10,9 @@ from __future__ import absolute_import, print_function
import
sys
import
os
import
os.path
# pylint:disable=no-name-in-module
import
struct
__all__
=
[]
def
system_bits
():
return
struct
.
calcsize
(
'P'
)
*
8
def
st_nlink_type
():
if
sys
.
platform
==
"darwin"
or
sys
.
platform
.
startswith
(
"freebsd"
):
return
"short"
if
system_bits
()
==
32
:
return
"unsigned long"
return
"long long"
__all__
=
[]
from
cffi
import
FFI
...
...
@@ -38,11 +26,15 @@ def read_source(name):
_cdef
=
read_source
(
'_corecffi_cdef.c'
)
_source
=
read_source
(
'_corecffi_source.c'
)
_cdef
=
_cdef
.
replace
(
'#define GEVENT_ST_NLINK_T int'
,
''
)
# These defines and uses help keep the C file readable and lintable by
# C tools.
_cdef
=
_cdef
.
replace
(
'#define GEVENT_STRUCT_DONE int'
,
''
)
_cdef
=
_cdef
.
replace
(
'GEVENT_ST_NLINK_T'
,
st_nlink_type
())
_cdef
=
_cdef
.
replace
(
"GEVENT_STRUCT_DONE _;"
,
'...;'
)
_cdef
=
_cdef
.
replace
(
'#define GEVENT_ST_NLINK_T int'
,
'typedef int... nlink_t;'
)
_cdef
=
_cdef
.
replace
(
'GEVENT_ST_NLINK_T'
,
'nlink_t'
)
if
sys
.
platform
.
startswith
(
'win'
):
# We must have the vfd_open, etc, functions on
...
...
src/gevent/libev/_corecffi_source.c
View file @
35286088
...
...
@@ -19,8 +19,8 @@ static void python_handle_error(void* handle, int revents);
static
void
python_stop
(
void
*
handle
);
static
void
_gevent_generic_callback
(
struct
ev_loop
*
loop
,
struct
ev_watcher
*
watcher
,
int
revents
)
struct
ev_watcher
*
watcher
,
int
revents
)
{
void
*
handle
=
watcher
->
data
;
int
cb_result
=
python_callback
(
handle
,
revents
);
...
...
@@ -45,7 +45,7 @@ static void _gevent_generic_callback(struct ev_loop* loop,
default:
fprintf
(
stderr
,
"WARNING: gevent: Unexpected return value %d from Python callback "
"for watcher %p and handle %
d
\n
"
,
"for watcher %p and handle %
p
\n
"
,
cb_result
,
watcher
,
handle
);
// XXX: Possible leaking of resources here? Should we be
...
...
src/gevent/libuv/_corecffi_build.py
View file @
35286088
# pylint: disable=no-member
# This module is only used to create and compile the gevent._corecffi module;
# This module is only used to create and compile the gevent.
libuv.
_corecffi module;
# nothing should be directly imported from it except `ffi`, which should only be
# used for `ffi.compile()`; programs should import gevent._corecfffi.
# However, because we are using "out-of-line" mode, it is necessary to examine
...
...
@@ -10,23 +10,12 @@ from __future__ import absolute_import, print_function
import
sys
import
os
import
os.path
# pylint:disable=no-name-in-module
import
struct
__all__
=
[]
WIN
=
sys
.
platform
.
startswith
(
'win32'
)
def
system_bits
():
return
struct
.
calcsize
(
'P'
)
*
8
def
st_nlink_type
():
if
sys
.
platform
==
"darwin"
or
sys
.
platform
.
startswith
(
"freebsd"
):
return
"short"
if
system_bits
()
==
32
:
return
"unsigned long"
return
"long long"
from
cffi
import
FFI
ffi
=
FFI
()
...
...
@@ -39,12 +28,18 @@ def read_source(name):
_cdef
=
read_source
(
'_corecffi_cdef.c'
)
_source
=
read_source
(
'_corecffi_source.c'
)
_cdef
=
_cdef
.
replace
(
'#define GEVENT_ST_NLINK_T int'
,
''
)
# These defines and uses help keep the C file readable and lintable by
# C tools.
_cdef
=
_cdef
.
replace
(
'#define GEVENT_STRUCT_DONE int'
,
''
)
_cdef
=
_cdef
.
replace
(
'#define GEVENT_UV_OS_SOCK_T int'
,
''
)
_cdef
=
_cdef
.
replace
(
'GEVENT_ST_NLINK_T'
,
st_nlink_type
())
_cdef
=
_cdef
.
replace
(
"GEVENT_STRUCT_DONE _;"
,
'...;'
)
# nlink_t is not used in libuv.
_cdef
=
_cdef
.
replace
(
'#define GEVENT_ST_NLINK_T int'
,
''
)
_cdef
=
_cdef
.
replace
(
'GEVENT_ST_NLINK_T'
,
'nlink_t'
)
_cdef
=
_cdef
.
replace
(
'#define GEVENT_UV_OS_SOCK_T int'
,
''
)
# uv_os_sock_t is int on POSIX and SOCKET on Win32, but socket is
# just another name for handle, which is just another name for 'void*'
# which we will treat as an 'unsigned long' or 'unsigned long long'
...
...
src/gevent/testing/testrunner.py
View file @
35286088
...
...
@@ -353,7 +353,10 @@ def print_list(lst):
log
(
' - %s'
,
name
)
def
_setup_environ
(
debug
=
False
):
if
'PYTHONWARNINGS'
not
in
os
.
environ
and
not
sys
.
warnoptions
:
if
(
'PYTHONWARNINGS'
not
in
os
.
environ
and
(
not
sys
.
warnoptions
# Python 3.7 goes from [] to ['default'] for nothing
or
sys
.
warnoptions
==
[
'default'
])):
# action:message:category:module:line
os
.
environ
[
'PYTHONWARNINGS'
]
=
','
.
join
([
...
...
@@ -373,6 +376,10 @@ def _setup_environ(debug=False):
'ignore:::importlib._bootstrap_external:'
,
# importing ABCs from collections, not collections.abc
'ignore:::pkg_resources._vendor.pyparsing:'
,
'ignore:::dns.namedict:'
,
# dns.hash itself is being deprecated, importing it raises the warning;
# we don't import it, but dnspython still does
'ignore:::dns.hash:'
,
])
if
'PYTHONFAULTHANDLER'
not
in
os
.
environ
:
...
...
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