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
2ea0b465
Commit
2ea0b465
authored
Feb 20, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the check_callback do stuff under PyPy to trigger signal delivery. Fixes #1112.
parent
a5f7a836
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
CHANGES.rst
CHANGES.rst
+4
-0
src/gevent/_ffi/loop.py
src/gevent/_ffi/loop.py
+26
-7
No files found.
CHANGES.rst
View file @
2ea0b465
...
@@ -82,6 +82,10 @@
...
@@ -82,6 +82,10 @@
- Fix a race condition in libuv child callbacks. See :issue:`1104`.
- Fix a race condition in libuv child callbacks. See :issue:`1104`.
- Signal handling under PyPy with libuv is more reliable. See
:issue:`1112`.
1.3a1 (2018-01-27)
1.3a1 (2018-01-27)
==================
==================
...
...
src/gevent/_ffi/loop.py
View file @
2ea0b465
...
@@ -14,6 +14,7 @@ from gevent._ffi import GEVENT_DEBUG_LEVEL
...
@@ -14,6 +14,7 @@ from gevent._ffi import GEVENT_DEBUG_LEVEL
from
gevent._ffi
import
TRACE
from
gevent._ffi
import
TRACE
from
gevent._ffi
import
CRITICAL
from
gevent._ffi
import
CRITICAL
from
gevent._ffi.callback
import
callback
from
gevent._ffi.callback
import
callback
from
gevent._compat
import
PYPY
from
gevent
import
getswitchinterval
from
gevent
import
getswitchinterval
...
@@ -225,14 +226,32 @@ class AbstractCallbacks(object):
...
@@ -225,14 +226,32 @@ class AbstractCallbacks(object):
watcher
=
self
.
from_handle
(
handle
)
watcher
=
self
.
from_handle
(
handle
)
watcher
.
stop
()
watcher
.
stop
()
def
python_check_callback
(
self
,
watcher_ptr
):
if
not
PYPY
:
# If we have the onerror callback, this is a no-op; all the real
def
python_check_callback
(
self
,
watcher_ptr
):
# pylint:disable=unused-argument
# work to rethrow the exception is done by the onerror callback
# If we have the onerror callback, this is a no-op; all the real
# work to rethrow the exception is done by the onerror callback
# NOTE: Unlike the rest of the functions, this is called with a pointer
# NOTE: Unlike the rest of the functions, this is called with a pointer
# to the C level structure, *not* a pointer to the void* that represents a
# to the C level structure, *not* a pointer to the void* that represents a
# <cdata> for the Python Watcher object.
# <cdata> for the Python Watcher object.
pass
pass
else
:
# PyPy
# On PyPy, we need the function to have some sort of body, otherwise
# the signal exceptions don't always get caught, *especially* with
# libuv (however, there's no reason to expect this to only be a libuv
# issue; it's just that we don't depend on the periodic signal timer
# under libev, so the issue is much more pronounced under libuv)
# test_socket's test_sendall_interrupted can hang.
# See https://github.com/gevent/gevent/issues/1112
def
python_check_callback
(
self
,
watcher_ptr
):
# pylint:disable=unused-argument
# Things we've tried that *don't* work:
# greenlet.getcurrent()
# 1 + 1
try
:
raise
MemoryError
()
except
MemoryError
:
pass
def
python_prepare_callback
(
self
,
watcher_ptr
):
def
python_prepare_callback
(
self
,
watcher_ptr
):
loop
=
self
.
_find_loop_from_c_watcher
(
watcher_ptr
)
loop
=
self
.
_find_loop_from_c_watcher
(
watcher_ptr
)
...
...
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