summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-02-04 01:04:31 -0800
committerGregory P. Smith <greg@krypto.org>2015-02-04 01:04:31 -0800
commitef3e7a803f7e575ce26cb2e4e29e46da2d89c124 (patch)
treeec9df5664c8029412e3923f694c3bbbbc9434ee6 /Lib/pydoc.py
parentf97d8cc43c09116bebd4d54b7ef5baf472058de3 (diff)
parent7c584647e0c2fe3f84299cab3b7941d1595de32f (diff)
downloadcpython-ef3e7a803f7e575ce26cb2e4e29e46da2d89c124.tar.gz
Skip some tests that require a subinterpreter launched with -E or -I when the
interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a test.script_helper.interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index d53a1b4b7e..60b0a9e545 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -264,9 +264,8 @@ def synopsis(filename, cache={}):
# XXX We probably don't need to pass in the loader here.
spec = importlib.util.spec_from_file_location('__temp__', filename,
loader=loader)
- _spec = importlib._bootstrap._SpecMethods(spec)
try:
- module = _spec.load()
+ module = importlib._bootstrap._load(spec)
except:
return None
del sys.modules['__temp__']
@@ -298,9 +297,8 @@ def importfile(path):
loader = importlib._bootstrap.SourceFileLoader(name, path)
# XXX We probably don't need to pass in the loader here.
spec = importlib.util.spec_from_file_location(name, path, loader=loader)
- _spec = importlib._bootstrap._SpecMethods(spec)
try:
- return _spec.load()
+ return importlib._bootstrap._load(spec)
except:
raise ErrorDuringImport(path, sys.exc_info())
@@ -1819,7 +1817,8 @@ class Helper:
if inspect.stack()[1][3] == '?':
self()
return ''
- return '<pydoc.Helper instance>'
+ return '<%s.%s instance>' % (self.__class__.__module__,
+ self.__class__.__qualname__)
_GoInteractive = object()
def __call__(self, request=_GoInteractive):
@@ -2068,9 +2067,8 @@ class ModuleScanner:
else:
path = None
else:
- _spec = importlib._bootstrap._SpecMethods(spec)
try:
- module = _spec.load()
+ module = importlib._bootstrap._load(spec)
except ImportError:
if onerror:
onerror(modname)