From 1c32d4fb71ec97001c0bc264835c2c4d95787297 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Jul 2016 11:35:16 +0800 Subject: [PATCH] monkey-patch Python 3.5.2 to disable broken asyncio.base_events._ipaddr_info optimization (#506) --- artiq/monkey_patches.py | 13 +++++++++++++ artiq/protocols/broadcast.py | 1 + artiq/protocols/logging.py | 1 + artiq/protocols/pc_rpc.py | 1 + artiq/protocols/sync_struct.py | 1 + 5 files changed, 17 insertions(+) create mode 100644 artiq/monkey_patches.py diff --git a/artiq/monkey_patches.py b/artiq/monkey_patches.py new file mode 100644 index 000000000..eeabe5f0f --- /dev/null +++ b/artiq/monkey_patches.py @@ -0,0 +1,13 @@ +import sys + + +__all__ = [] + + +if sys.version_info[:3] == (3, 5, 2): + import asyncio + + # See https://github.com/m-labs/artiq/issues/506 + def _ipaddr_info(host, port, family, type, proto): + return None + asyncio.base_events._ipaddr_info = _ipaddr_info diff --git a/artiq/protocols/broadcast.py b/artiq/protocols/broadcast.py index 636bad6e1..9cffc6b78 100644 --- a/artiq/protocols/broadcast.py +++ b/artiq/protocols/broadcast.py @@ -1,5 +1,6 @@ import asyncio +from artiq.monkey_patches import * from artiq.protocols import pyon from artiq.protocols.asyncio_server import AsyncioServer diff --git a/artiq/protocols/logging.py b/artiq/protocols/logging.py index 0c600e288..b166f969b 100644 --- a/artiq/protocols/logging.py +++ b/artiq/protocols/logging.py @@ -2,6 +2,7 @@ import asyncio import logging import re +from artiq.monkey_patches import * from artiq.protocols.asyncio_server import AsyncioServer from artiq.tools import TaskObject, MultilineFormatter diff --git a/artiq/protocols/pc_rpc.py b/artiq/protocols/pc_rpc.py index 1ba4b17c4..1f56481b2 100644 --- a/artiq/protocols/pc_rpc.py +++ b/artiq/protocols/pc_rpc.py @@ -19,6 +19,7 @@ import logging import inspect from operator import itemgetter +from artiq.monkey_patches import * from artiq.protocols import pyon from artiq.protocols.asyncio_server import AsyncioServer as _AsyncioServer from artiq.protocols.packed_exceptions import * diff --git a/artiq/protocols/sync_struct.py b/artiq/protocols/sync_struct.py index ce6479e7b..59bced790 100644 --- a/artiq/protocols/sync_struct.py +++ b/artiq/protocols/sync_struct.py @@ -14,6 +14,7 @@ import asyncio from operator import getitem from functools import partial +from artiq.monkey_patches import * from artiq.protocols import pyon from artiq.protocols.asyncio_server import AsyncioServer