summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-07-29 15:53:12 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-07-29 15:53:12 (GMT)
commitf63e343c39902e05a947320bb843a95e5b3d4535 (patch)
treee000553b196ef276705a7f237837a5b3701beb16 /Lib/doctest.py
parent638c722228940d62662f2337ed4c47c30afed37a (diff)
downloadcpython-f63e343c39902e05a947320bb843a95e5b3d4535.zip
cpython-f63e343c39902e05a947320bb843a95e5b3d4535.tar.gz
cpython-f63e343c39902e05a947320bb843a95e5b3d4535.tar.bz2
uhh. __builtins__ is a module in __main__ and a dict elsewhere
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 64a0375..e2b595e 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1360,7 +1360,10 @@ class DocTestRunner:
linecache.getlines = self.save_linecache_getlines
if clear_globs:
test.globs.clear()
- __builtins__['_'] = None
+ if __name__ == "__main__":
+ __builtins__._ = None
+ else:
+ __builtins__['_'] = None
#/////////////////////////////////////////////////////////////////
# Summarization