-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #508: Py37 Deadlock ThreadPoolExecutor #598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Issue #508: test ThreadPoolExecutor with monkey-patching | ||
__test__ = False | ||
|
||
if __name__ == '__main__': | ||
import eventlet | ||
eventlet.monkey_patch() | ||
|
||
import sys | ||
|
||
# Futures is only included in 3.2 or later | ||
if sys.version_info >= (3, 2): | ||
from concurrent import futures | ||
|
||
with futures.ThreadPoolExecutor(max_workers=1) as executor: | ||
future = executor.submit(pow, 2, 3) | ||
res = future.result() | ||
assert res == 8, '2^3 should be 8, not %s' % res | ||
print('pass') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like a bit of an indirect test; something like
seems a little more obvious -- could even tighten it to just use OTOH, this more-clearly demonstrates the fact that we had a thing that was working when monkey-patched prior to 3.7 and stopped working after. *shrug* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -511,3 +511,7 @@ def test_regular_file_readall(): | |
|
||
def test_threading_current(): | ||
tests.run_isolated('patcher_threading_current.py') | ||
|
||
|
||
def test_threadpoolexecutor(): | ||
tests.run_isolated('patcher_threadpoolexecutor.py') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was a little worried about how tests still pass when I reverted the change to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we only do this when
on['thread']
is true? It shouldn't be a problem otherwise, right?OTOH, we have precedent for a blanket use-more-python approach up just a few lines above...