Skip to content

[skip issue]Small changes in importing process of multiprocessing package #6856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Lib/multiprocessing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
# Copy stuff from default context
#

globals().update((name, getattr(context._default_context, name))
for name in context._default_context.__all__)
__all__ = context._default_context.__all__
__all__ = [x for x in dir(context._default_context) if not x.startswith('_')]
globals().update((name, getattr(context._default_context, name)) for name in __all__)

#
# XXX These should not really be documented or public.
Expand Down
6 changes: 2 additions & 4 deletions Lib/multiprocessing/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from . import process
from . import reduction

__all__ = [] # things are copied from here to __init__.py
__all__ = ()

#
# Exceptions
Expand All @@ -24,7 +24,7 @@ class AuthenticationError(ProcessError):
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):
Expand Down Expand Up @@ -261,8 +261,6 @@ def get_all_start_methods(self):
else:
return ['fork', 'spawn']

DefaultContext.__all__ = [x for x in dir(DefaultContext) if x[0] != '_']

#
# Context types for fixed start method
#
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4573,6 +4573,12 @@ def test_empty(self):

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
#
Expand Down