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
bc740c5f
Commit
bc740c5f
authored
Sep 15, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #651 and fix #652 by removing a runtime import.
parent
67ef9936
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
+34
-11
.pep8
.pep8
+1
-1
changelog.rst
changelog.rst
+7
-0
gevent/hub.py
gevent/hub.py
+7
-10
greentest/_import_wait.py
greentest/_import_wait.py
+12
-0
greentest/test__import_wait.py
greentest/test__import_wait.py
+7
-0
No files found.
.pep8
View file @
bc740c5f
[pep8]
ignore=E702,E265,E402,E731,E266,E261,W503,E129
max_line_length=160
exclude=.eggs,.tox,.git,build,2.6,2.7,2.7pypy,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py,3.4
exclude=.eggs,.tox,.git,build,2.6,2.7,2.7pypy,3.3,
3.5,
test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py,3.4
changelog.rst
View file @
bc740c5f
...
...
@@ -36,6 +36,13 @@
``subprocess.run`` but impacts all versions (``timeout`` is an
official argument under Python 3 and a gevent extension with
slightly different semantics under Python 2).
- gevent blocking operations performed at the top-level of a module
after the system was monkey-patched under Python 2 could result in
raising a ``LoopExit`` instead of completing the expected blocking
operation. Note that performing gevent blocking operations in the
top-level of a module is typically not recommended, but this
situation can arise when monkey-patching existing scripts. Reported
in :issue:`651` and :issue:`652` by Mike Kaplinskiy.
.. _WSGI specification: https://www.python.org/dev/peps/pep-3333/#the-start-response-callable
...
...
gevent/hub.py
View file @
bc740c5f
...
...
@@ -820,19 +820,16 @@ class _MultipleWaiter(Waiter):
This does not handle exceptions or throw methods.
"""
_DEQUE
=
None
__slots__
=
[
'_values'
]
def
__init__
(
self
,
*
args
,
**
kwargs
):
Waiter
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
_values
=
self
.
_deque
()
@
classmethod
def
_deque
(
cls
):
if
cls
.
_DEQUE
is
None
:
from
collections
import
deque
cls
.
_DEQUE
=
deque
return
cls
.
_DEQUE
()
# we typically expect a relatively small number of these to be outstanding.
# since we pop from the left, a deque might be slightly
# more efficient, but since we're in the hub we avoid imports if
# we can help it to better support monkey-patching, and delaying the import
# here can be impractical (see https://github.com/gevent/gevent/issues/652)
self
.
_values
=
list
()
def
switch
(
self
,
value
):
self
.
_values
.
append
(
value
)
...
...
@@ -843,7 +840,7 @@ class _MultipleWaiter(Waiter):
Waiter
.
get
(
self
)
Waiter
.
clear
(
self
)
return
self
.
_values
.
pop
left
(
)
return
self
.
_values
.
pop
(
0
)
def
iwait
(
objects
,
timeout
=
None
,
count
=
None
):
...
...
greentest/_import_wait.py
0 → 100644
View file @
bc740c5f
# test__import_wait.py calls this
import
gevent
def
fn2
():
return
2
def
fn
():
return
gevent
.
wait
([
gevent
.
spawn
(
fn2
),
gevent
.
spawn
(
fn2
)])
x
=
gevent
.
spawn
(
fn
).
get
()
greentest/test__import_wait.py
0 → 100644
View file @
bc740c5f
# https://github.com/gevent/gevent/issues/652
from
gevent
import
monkey
monkey
.
patch_all
()
import
_import_wait
assert
_import_wait
.
x
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