summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2008-07-02 13:09:19 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2008-07-02 13:09:19 (GMT)
commitc060b0e7eb140cb13dfb51f954883241f1ddabc6 (patch)
tree3830e69b54e6d84ad5e6ca36d0fc1de2f4f14094
parent70c3289085d08d97edbfaa626efc2d2c2ac21859 (diff)
downloadcpython-c060b0e7eb140cb13dfb51f954883241f1ddabc6.zip
cpython-c060b0e7eb140cb13dfb51f954883241f1ddabc6.tar.gz
cpython-c060b0e7eb140cb13dfb51f954883241f1ddabc6.tar.bz2
Issue 3190: pydoc now hides module __package__ attributes
-rwxr-xr-xLib/pydoc.py5
-rw-r--r--Lib/test/test_pydoc.py2
-rw-r--r--Misc/NEWS3
3 files changed, 6 insertions, 4 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 58e8067..2035f78 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -160,8 +160,9 @@ def _split_list(s, predicate):
def visiblename(name, all=None):
"""Decide whether to show documentation on a variable."""
# Certain special names are redundant.
- if name in ('__builtins__', '__doc__', '__file__', '__path__',
- '__module__', '__name__', '__slots__'): return 0
+ _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__',
+ '__module__', '__name__', '__slots__', '__package__')
+ if name in _hidden_names: return 0
# Private names are hidden, but special names are displayed.
if name.startswith('__') and name.endswith('__'): return 1
if all is not None:
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index c78e986..91a9977 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -57,7 +57,6 @@ FUNCTIONS
DATA
__author__ = 'Benjamin Peterson'
__credits__ = 'Nobody'
- __package__ = None
__version__ = '1.2.3.4'
VERSION
@@ -146,7 +145,6 @@ war</tt></dd></dl>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><strong>__author__</strong> = 'Benjamin Peterson'<br>
<strong>__credits__</strong> = 'Nobody'<br>
-<strong>__package__</strong> = None<br>
<strong>__version__</strong> = '1.2.3.4'</td></tr></table><p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
diff --git a/Misc/NEWS b/Misc/NEWS
index 686a87f..36afc09 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,9 @@ Core and Builtins
Library
-------
+- Issue #3190: Pydoc now hides the automatic module attribute __package__ (the
+ handling is now the same as that of other special attributes like __name__).
+
- Issue #2885 (partial): The urllib.urlopen() function has been deprecated for
removal in Python 3.0 in favor of urllib2.urlopen().