From 7da95a806d21b619d7300aa9082218774fe923e8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 23 Apr 2019 21:55:27 -0400 Subject: [PATCH] Rename override module --- ..._forkserver_hackzorz.py => _forkserver_override.py} | 10 +++++----- tractor/_spawn.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) rename tractor/{_forkserver_hackzorz.py => _forkserver_override.py} (97%) diff --git a/tractor/_forkserver_hackzorz.py b/tractor/_forkserver_override.py similarity index 97% rename from tractor/_forkserver_hackzorz.py rename to tractor/_forkserver_override.py index 411d190..68d8333 100644 --- a/tractor/_forkserver_hackzorz.py +++ b/tractor/_forkserver_override.py @@ -51,7 +51,7 @@ class PatchedForkServer(ForkServer): semaphore_tracker.getfd()] allfds += fds - # This is the only part changed + # XXX This is the only part changed try: while True: try: @@ -64,7 +64,7 @@ class PatchedForkServer(ForkServer): client.connect(self._forkserver_address) continue raise - # This is the only part changed + # XXX This is the only part changed return parent_r, parent_w except Exception: @@ -97,7 +97,7 @@ class PatchedForkServer(ForkServer): self._forkserver_pid = None # XXX only thing that changed! - cmd = ('from tractor._forkserver_hackzorz import main; ' + + cmd = ('from tractor._forkserver_override import main; ' + 'main(%d, %d, %r, **%r)') if self._preload_modules: @@ -231,14 +231,14 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None): # Incoming fork request with listener.accept()[0] as s: - # Thing changed - be tolerant of socket disconnects + # XXX Thing changed - be tolerant of socket disconnects try: # Receive fds from client fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1) except EOFError: # broken socket due to reconnection on client-side continue - # Thing changed - be tolerant of socket disconnects + # XXX Thing changed - be tolerant of socket disconnects if len(fds) > MAXFDS_TO_SEND: raise RuntimeError( diff --git a/tractor/_spawn.py b/tractor/_spawn.py index 2d8a4bf..0b6916f 100644 --- a/tractor/_spawn.py +++ b/tractor/_spawn.py @@ -7,7 +7,7 @@ import multiprocessing as mp from multiprocessing import forkserver, semaphore_tracker # type: ignore from typing import Tuple, Optional -from . import _forkserver_hackzorz +from . import _forkserver_override from ._state import current_actor from ._actor import Actor @@ -32,7 +32,7 @@ def try_set_start_method(name: str) -> mp.context.BaseContext: "`fork` is unsupported due to incompatibility with `trio`" ) elif name == 'forkserver': - _forkserver_hackzorz.override_stdlib() + _forkserver_override.override_stdlib() assert name in allowed