Simplify __all__ in multiprocessing (GH-6856)

This commit is contained in:
Derek B. Kim 2018-07-11 19:22:28 +09:00 committed by INADA Naoki
parent 5e5bbbec46
commit c40278ef95
3 changed files with 10 additions and 7 deletions

View File

@ -19,9 +19,8 @@ from . import context
# Copy stuff from default context # Copy stuff from default context
# #
globals().update((name, getattr(context._default_context, name)) __all__ = [x for x in dir(context._default_context) if not x.startswith('_')]
for name in context._default_context.__all__) globals().update((name, getattr(context._default_context, name)) for name in __all__)
__all__ = context._default_context.__all__
# #
# XXX These should not really be documented or public. # XXX These should not really be documented or public.

View File

@ -5,7 +5,7 @@ import threading
from . import process from . import process
from . import reduction from . import reduction
__all__ = [] # things are copied from here to __init__.py __all__ = ()
# #
# Exceptions # Exceptions
@ -24,7 +24,7 @@ class AuthenticationError(ProcessError):
pass pass
# #
# Base type for contexts # Base type for contexts. Bound methods of an instance of this type are included in __all__ of __init__.py
# #
class BaseContext(object): class BaseContext(object):
@ -261,8 +261,6 @@ class DefaultContext(BaseContext):
else: else:
return ['fork', 'spawn'] return ['fork', 'spawn']
DefaultContext.__all__ = [x for x in dir(DefaultContext) if x[0] != '_']
# #
# Context types for fixed start method # Context types for fixed start method
# #

View File

@ -4582,6 +4582,12 @@ class TestSimpleQueue(unittest.TestCase):
proc.join() proc.join()
class MiscTestCase(unittest.TestCase):
def test__all__(self):
# Just make sure names in blacklist are excluded
support.check__all__(self, multiprocessing, extra=multiprocessing.__all__,
blacklist=['SUBDEBUG', 'SUBWARNING'])
# #
# Mixins # Mixins
# #