[skip issue]Small changes in importing process of multiprocessing package by bombs-kim · Pull Request #6856 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation14 Commits5 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

bombs-kim

It seems that the way multiprocessing package set __all__ is overly complex. And __all__ in context.py is not used in __init__.py so I guess the comment there is misleading.

Derek Kim added 2 commits

May 15, 2018 18:55

@the-knights-who-say-ni

This comment has been minimized.

@bombs-kim bombs-kim changed the titleSmall changes in importing mechanism of multiprocessing library Small changes in importing process of multiprocessing package

May 15, 2018

@bombs-kim

This comment has been minimized.

@bombs-kim

@1st1 I've submitted PSF form. Maybe some errors has happened. Could you please check this out and remove CLA not sign tag?

@1st1

Added Davin as a reviewer as multiprocessing is his territory.

@serhiy-storchaka

Please add tests for __all__. The test.support.check__all__ helper can be used for this.

@bombs-kim

@serhiy-storchaka Thank you so much. I will upload that as early as I can, but it can take some time because I'm new to test

@serhiy-storchaka

Just look how this helper is used in other tests.

@bombs-kim

@serhiy-storchaka Sorry for being late. I've added a test case but I'm not sure this is what you intended. Public objects in multiprocessing package are bound methods of multiprocessing.context._default_context object and they don't have __module__ attributes and they are not types.ModuleType, either. So I think using check__all__ is pretty pointless here because you cannot make expected automatically in that function.

@bombs-kim bombs-kim changed the titleSmall changes in importing process of multiprocessing package [skip issue]Small changes in importing process of multiprocessing package

Jun 15, 2018

@bombs-kim

@applio I know it's a trivial contribution, but I want to know the progress of PR.

methane

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[0].startswith('_')]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't x[0].startswith('_') be x.startswith('_')?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. Thank you🙂

@@ -5,7 +5,7 @@
from . import process
from . import reduction
__all__ = [] # things are copied from here to __init__.py
__all__ = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use __all__ = ()? Or __all__ is modified later?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's modified. I will run the test and tell you the result

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@methane I updated things that you pointed out. It passed all tests. Thanks.

Derek Kim added 2 commits

July 3, 2018 17:43

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request

Jul 14, 2018

@CuriousLearner

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request

Jul 15, 2018

@CuriousLearner

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request

Jul 21, 2018

@CuriousLearner

…ssue-33014