Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
gevent
Commits
81f2552e
Commit
81f2552e
authored
9 years ago
by
Jason Madden
Browse files
Options
Download
Email Patches
Plain Diff
Raise the correct exception from gevent.kill. Fixes #623.
parent
e2ec8bb7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
5 deletions
+29
-5
changelog.rst
changelog.rst
+2
-0
gevent/_fileobjectposix.py
gevent/_fileobjectposix.py
+1
-1
gevent/greenlet.py
gevent/greenlet.py
+3
-2
gevent/hub.py
gevent/hub.py
+1
-1
gevent/socket.py
gevent/socket.py
+1
-1
greentest/test__issue330.py
greentest/test__issue330.py
+21
-0
No files found.
changelog.rst
View file @
81f2552e
...
...
@@ -11,6 +11,8 @@ Unreleased
- On some versions of PyPy on some platforms (notably 2.6.0 on 64-bit
Linux), enabling ``gevent.monkey.patch_builtins`` could cause PyPy
to crash. Reported in :issue:`618` by Jay Oster.
- ``gevent.kill`` raises the correct exception in the target greenlet.
Reported in :issue:`623` by Jonathan Kamens.
1.1b1 (Jul 17, 2015)
====================
...
...
This diff is collapsed.
Click to expand it.
gevent/_fileobjectposix.py
View file @
81f2552e
...
...
@@ -127,7 +127,7 @@ class FileObjectPosix(object):
"""
A file-like object that operates on non-blocking files.
.. se
a
lso:: :func:`gevent.os.make_nonblocking`
.. se
e
lso:: :func:`gevent.os.make_nonblocking`
"""
default_bufsize
=
io
.
DEFAULT_BUFFER_SIZE
...
...
This diff is collapsed.
Click to expand it.
gevent/greenlet.py
View file @
81f2552e
...
...
@@ -399,7 +399,7 @@ class Greenlet(greenlet):
if
self
.
dead
:
self
.
__handle_death_before_start
(
exception
)
else
:
waiter
=
Waiter
()
waiter
=
Waiter
()
if
block
else
None
self
.
parent
.
loop
.
run_callback
(
_kill
,
self
,
exception
,
waiter
)
if
block
:
waiter
.
get
()
...
...
@@ -578,7 +578,8 @@ def _kill(greenlet, exception, waiter):
except
:
# XXX do we need this here?
greenlet
.
parent
.
handle_error
(
greenlet
,
*
sys
.
exc_info
())
waiter
.
switch
()
if
waiter
is
not
None
:
waiter
.
switch
()
def
joinall
(
greenlets
,
timeout
=
None
,
raise_error
=
False
,
count
=
None
):
...
...
This diff is collapsed.
Click to expand it.
gevent/hub.py
View file @
81f2552e
...
...
@@ -157,7 +157,7 @@ def kill(greenlet, exception=GreenletExit):
# dealing with gevent.greenlet.Greenlet. Use it, especially
# to avoid allowing one to be switched to for the first time
# after it's been killed
greenlet
.
kill
(
block
=
False
)
greenlet
.
kill
(
exception
=
exception
,
block
=
False
)
else
:
get_hub
().
loop
.
run_callback
(
greenlet
.
throw
,
exception
)
...
...
This diff is collapsed.
Click to expand it.
gevent/socket.py
View file @
81f2552e
# Copyright (c) 2009-2014 Denis Bilenko and gevent contributors. See LICENSE for details.
"""Cooperative
socket modul
e.
"""Cooperative
low-level networking interfac
e.
This module provides socket operations and some related functions.
The API of the functions and classes matches the API of the corresponding
...
...
This diff is collapsed.
Click to expand it.
greentest/test__issue330.py
View file @
81f2552e
...
...
@@ -44,3 +44,24 @@ g2 = gevent.spawn(runner, 1)
g
.
throw
(
gevent
.
GreenletExit
)
g2
.
throw
(
gevent
.
GreenletExit
)
check
(
g
,
g2
)
# Killing with gevent.kill gets the right exception
class
MyException
(
Exception
):
pass
def
catcher
():
try
:
while
True
:
gevent
.
sleep
(
0
)
except
Exception
as
e
:
switched_to
[
0
]
=
e
g
=
gevent
.
spawn
(
catcher
)
g
.
start
()
gevent
.
sleep
()
gevent
.
kill
(
g
,
MyException
())
gevent
.
sleep
()
assert
isinstance
(
switched_to
[
0
],
MyException
),
switched_to
This diff is collapsed.
Click to expand it.
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