[Python-checkins] cpython: Issue #15163: Pydoc shouldn't show __loader__ as a part of a module's

brett.cannon python-checkins at python.org
Mon Aug 6 23:19:28 CEST 2012


http://hg.python.org/cpython/rev/6a27b9f37b05
changeset:   78457:6a27b9f37b05
user:        Brett Cannon <brett at python.org>
date:        Mon Aug 06 17:19:22 2012 -0400
summary:
  Issue #15163: Pydoc shouldn't show __loader__ as a part of a module's
data.

Also alphabetized the attributes in the blacklist to make it easier to
detect changes.

Initial patch by Éric Araujo.

files:
  Lib/pydoc.py |  10 +++++-----
  Misc/NEWS    |   2 ++
  2 files changed, 7 insertions(+), 5 deletions(-)


diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -163,11 +163,11 @@
 
 def visiblename(name, all=None, obj=None):
     """Decide whether to show documentation on a variable."""
-    # Certain special names are redundant.
-    if name in {'__builtins__', '__doc__', '__file__', '__path__',
-                     '__module__', '__name__', '__slots__', '__package__',
-                     '__cached__', '__author__', '__credits__', '__date__',
-                     '__version__', '__qualname__', '__initializing__'}:
+    # Certain special names are redundant or internal.
+    if name in {'__author__', '__builtins__', '__cached__', '__credits__',
+                '__date__', '__doc__', '__file__', '__initializing__',
+                '__loader__', '__module__', '__name__', '__package__',
+                '__path__', '__qualname__', '__slots__', '__version__'}:
         return 0
     # Private names are hidden, but special names are displayed.
     if name.startswith('__') and name.endswith('__'): return 1
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,8 @@
 Library
 -------
 
+- Issue #15163: Pydoc shouldn't list __loader__ as module data.
+
 - Issue #15471: Do not use mutable objects as defaults for
   importlib.__import__().
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list