Merge pull request #75 from goodboy/rename_forkserver_mod

Rename override module
pip_ci_fix
goodboy 2019-10-15 01:05:45 -04:00 committed by GitHub
commit 22b5c1c207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ class PatchedForkServer(ForkServer):
semaphore_tracker.getfd()] semaphore_tracker.getfd()]
allfds += fds allfds += fds
# This is the only part changed # XXX This is the only part changed
try: try:
while True: while True:
try: try:
@ -64,7 +64,7 @@ class PatchedForkServer(ForkServer):
client.connect(self._forkserver_address) client.connect(self._forkserver_address)
continue continue
raise raise
# This is the only part changed # XXX This is the only part changed
return parent_r, parent_w return parent_r, parent_w
except Exception: except Exception:
@ -97,7 +97,7 @@ class PatchedForkServer(ForkServer):
self._forkserver_pid = None self._forkserver_pid = None
# XXX only thing that changed! # XXX only thing that changed!
cmd = ('from tractor._forkserver_hackzorz import main; ' + cmd = ('from tractor._forkserver_override import main; ' +
'main(%d, %d, %r, **%r)') 'main(%d, %d, %r, **%r)')
if self._preload_modules: if self._preload_modules:
@ -231,14 +231,14 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None):
# Incoming fork request # Incoming fork request
with listener.accept()[0] as s: with listener.accept()[0] as s:
# Thing changed - be tolerant of socket disconnects # XXX Thing changed - be tolerant of socket disconnects
try: try:
# Receive fds from client # Receive fds from client
fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1) fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
except EOFError: except EOFError:
# broken socket due to reconnection on client-side # broken socket due to reconnection on client-side
continue continue
# Thing changed - be tolerant of socket disconnects # XXX Thing changed - be tolerant of socket disconnects
if len(fds) > MAXFDS_TO_SEND: if len(fds) > MAXFDS_TO_SEND:
raise RuntimeError( raise RuntimeError(

View File

@ -7,7 +7,7 @@ import multiprocessing as mp
from multiprocessing import forkserver, semaphore_tracker # type: ignore from multiprocessing import forkserver, semaphore_tracker # type: ignore
from typing import Tuple, Optional from typing import Tuple, Optional
from . import _forkserver_hackzorz from . import _forkserver_override
from ._state import current_actor from ._state import current_actor
from ._actor import 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`" "`fork` is unsupported due to incompatibility with `trio`"
) )
elif name == 'forkserver': elif name == 'forkserver':
_forkserver_hackzorz.override_stdlib() _forkserver_override.override_stdlib()
assert name in allowed assert name in allowed