Skip to content

Commit

Permalink
tornado: use WindowsSelectorEventLoopPolicy() with Python 3.8 (#65)
Browse files Browse the repository at this point in the history
Python 3.8 changed the default event loop to ProactorEventLoop which doesn't
implement everything required by tornado and breaks the benchmark.

This makes WindowsSelectorEventLoop the default again like suggested in:
tornadoweb/tornado#2686

Limit to 3.8 only in the hopes that the new event loop supports the required
methods with 3.9.

Fixes #61
  • Loading branch information
lazka authored and vstinner committed Jul 30, 2019
1 parent 748db03 commit 98e9f05
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyperformance/benchmarks/bm_tornado_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
data as a HTTP response's body.
"""

import sys
import socket

from six.moves import xrange
Expand Down Expand Up @@ -86,6 +87,16 @@ def run_client():


if __name__ == "__main__":
# 3.8 changed the default event loop to ProactorEventLoop which doesn't
# implement everything required by tornado and breaks this benchmark.
# Restore the old WindowsSelectorEventLoop default for now.
# https://bugs.python.org/issue37373
# https://github.com/python/pyperformance/issues/61
# https://github.com/tornadoweb/tornado/pull/2686
if sys.platform == 'win32' and sys.version_info[:2] == (3, 8):
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

kw = {}
if pyperf.python_has_jit():
# PyPy needs to compute more warmup values to warmup its JIT
Expand Down

0 comments on commit 98e9f05

Please sign in to comment.