summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py5
-rwxr-xr-xLib/pydoc.py10
2 files changed, 8 insertions, 7 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index b9b35ec..4f61a5b 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1587,7 +1587,7 @@ def _get_supported_file_loaders():
return [extensions, source, bytecode]
-def __import__(name, globals={}, locals={}, fromlist=[], level=0):
+def __import__(name, globals=None, locals=None, fromlist=(), level=0):
"""Import a module.
The 'globals' argument is used to infer where the import is occuring from
@@ -1601,7 +1601,8 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=0):
if level == 0:
module = _gcd_import(name)
else:
- package = _calc___package__(globals)
+ globals_ = globals if globals is not None else {}
+ package = _calc___package__(globals_)
module = _gcd_import(name, package, level)
if not fromlist:
# Return up to the first dot in 'name'. This is complicated by the fact
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index a030f68..aa296c4 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -163,11 +163,11 @@ def _split_list(s, predicate):
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