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
81846faf
Commit
81846faf
authored
Jun 19, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #578 from hashstat/fix461+471
Fix for issues #461 and #471.
parents
13e1fd71
b7dd309e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
gevent/hub.py
gevent/hub.py
+6
-1
greentest/test__issues461_471.py
greentest/test__issues461_471.py
+48
-0
No files found.
gevent/hub.py
View file @
81846faf
...
@@ -334,7 +334,12 @@ class Hub(greenlet):
...
@@ -334,7 +334,12 @@ class Hub(greenlet):
cb
.
stop
()
cb
.
stop
()
def
print_exception
(
self
,
context
,
type
,
value
,
tb
):
def
print_exception
(
self
,
context
,
type
,
value
,
tb
):
traceback
.
print_exception
(
type
,
value
,
tb
)
# Python 3 does not gracefully handle None value or tb in
# traceback.print_exception() as previous versions did.
if
value
is
None
:
sys
.
stderr
.
write
(
'%s
\
n
'
%
type
.
__name__
)
else
:
traceback
.
print_exception
(
type
,
value
,
tb
)
del
tb
del
tb
if
context
is
not
None
:
if
context
is
not
None
:
if
not
isinstance
(
context
,
str
):
if
not
isinstance
(
context
,
str
):
...
...
greentest/test__issues461_471.py
0 → 100644
View file @
81846faf
'''Test for GitHub issues 461 and 471.
When moving to Python 3, handling of KeyboardInterrupt exceptions caused
by a Ctrl-C raise an exception while printing the traceback for a
greenlet preventing the process from exiting. This test tests for proper
handling of KeyboardInterrupt.
'''
import
sys
if
sys
.
argv
[
1
:]
==
[
'subprocess'
]:
import
gevent
def
task
():
sys
.
stdout
.
write
(
'ready
\
n
'
)
sys
.
stdout
.
flush
()
gevent
.
sleep
(
30
)
try
:
gevent
.
spawn
(
task
).
get
()
except
KeyboardInterrupt
:
pass
else
:
import
signal
from
subprocess
import
Popen
,
PIPE
import
time
if
sys
.
platform
.
startswith
(
'win'
):
from
subprocess
import
CREATE_NEW_PROCESS_GROUP
kwargs
=
{
'creationflags'
:
CREATE_NEW_PROCESS_GROUP
}
else
:
kwargs
=
{}
p
=
Popen
([
sys
.
executable
,
__file__
,
'subprocess'
],
stdout
=
PIPE
,
**
kwargs
)
line
=
p
.
stdout
.
readline
()
if
not
isinstance
(
line
,
str
):
line
=
line
.
decode
(
'ascii'
)
assert
line
==
'ready
\
n
'
p
.
send_signal
(
signal
.
SIGINT
)
# Wait up to 3 seconds for child process to die
for
i
in
range
(
30
):
if
p
.
poll
()
is
not
None
:
break
time
.
sleep
(
0.1
)
else
:
# Kill unresponsive child and exit with error 1
p
.
terminate
()
p
.
wait
()
sys
.
exit
(
1
)
sys
.
exit
(
p
.
returncode
)
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