[pypy-svn] pypy default: Add a custom pydoc.py: check that we don't report the __builtin__

arigo commits-noreply at bitbucket.org
Sun Feb 13 16:06:59 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41876:83531d4e78dc
Date: 2011-02-13 16:06 +0100
http://bitbucket.org/pypy/pypy/changeset/83531d4e78dc/

Log:	Add a custom pydoc.py: check that we don't report the __builtin__
	module. This issue arises because '__builtins__' is sometimes the
	module and sometimes the dict, and when it is which are not exactly
	the same in PyPy and CPython.

diff --git a/lib-python/2.7.0/pydoc.py b/lib-python/modified-2.7.0/pydoc.py
copy from lib-python/2.7.0/pydoc.py
copy to lib-python/modified-2.7.0/pydoc.py
--- a/lib-python/2.7.0/pydoc.py
+++ b/lib-python/modified-2.7.0/pydoc.py
@@ -620,7 +620,9 @@
             head, '#ffffff', '#7799ee',
             '<a href=".">index</a><br>' + filelink + docloc)
 
-        modules = inspect.getmembers(object, inspect.ismodule)
+        def isnonbuiltinmodule(obj):
+            return inspect.ismodule(obj) and obj is not __builtin__
+        modules = inspect.getmembers(object, isnonbuiltinmodule)
 
         classes, cdict = [], {}
         for key, value in inspect.getmembers(object, inspect.isclass):


More information about the Pypy-commit mailing list