From 02c298da4fca72d2c46697ba39118b0b37a398ab Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Tue, 15 May 2018 18:55:51 +0900 Subject: [PATCH 1/5] Changed unnecessarily complex way of updating of __all__ and globals in __init__.py --- Lib/multiprocessing/__init__.py | 5 ++--- Lib/multiprocessing/context.py | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Lib/multiprocessing/__init__.py b/Lib/multiprocessing/__init__.py index 86df6383703756..ce615a90af85a6 100644 --- a/Lib/multiprocessing/__init__.py +++ b/Lib/multiprocessing/__init__.py @@ -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[0].startswith('_')] +globals().update((name, getattr(context._default_context, name)) for name in __all__) # # XXX These should not really be documented or public. diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index c98ee434249037..6ad1255aa8eac6 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -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): @@ -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 # From eb07cb545f3e3ed5708edf5dee4591d6f89df470 Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Tue, 15 May 2018 19:01:06 +0900 Subject: [PATCH 2/5] Maybe a misguiding comment --- Lib/multiprocessing/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 6ad1255aa8eac6..97f128bc13e649 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -5,7 +5,7 @@ from . import process from . import reduction -__all__ = [] # things are copied from here to __init__.py +__all__ = [] # # Exceptions From 25335c38d5ff7ccbb0b7030f409a52a75b1b2426 Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Fri, 1 Jun 2018 11:00:41 +0900 Subject: [PATCH 3/5] Added a trivial test for __all__ --- Lib/test/_test_multiprocessing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 8b6bc4b23a0267..792e3d2a41a171 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -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 # From ef222acdc8ca9211887398d636051bf8f6e5caec Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Tue, 3 Jul 2018 17:43:57 +0900 Subject: [PATCH 4/5] Trivial error fixed --- Lib/multiprocessing/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/multiprocessing/__init__.py b/Lib/multiprocessing/__init__.py index ce615a90af85a6..8336f381decaac 100644 --- a/Lib/multiprocessing/__init__.py +++ b/Lib/multiprocessing/__init__.py @@ -19,7 +19,7 @@ # Copy stuff from default context # -__all__ = [x for x in dir(context._default_context) if not x[0].startswith('_')] +__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__) # From 2e617a25cd3f1f07a431eb4d3888ec212004945a Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Tue, 3 Jul 2018 17:44:42 +0900 Subject: [PATCH 5/5] __all__ is not supposed to be modified --- Lib/multiprocessing/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 97f128bc13e649..871746b1a047b3 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -5,7 +5,7 @@ from . import process from . import reduction -__all__ = [] +__all__ = () # # Exceptions pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy