summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-06-24 20:24:16 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-06-24 20:24:16 (GMT)
commitfee69d0313afcbe38b4ac3803c70b7420f575f94 (patch)
tree27993bf289ed06322c6c299945d6aa90db6fea63
parentd4ad59e1eb9623acb8af5555a58984fe6a252183 (diff)
downloadcpython-fee69d0313afcbe38b4ac3803c70b7420f575f94.zip
cpython-fee69d0313afcbe38b4ac3803c70b7420f575f94.tar.gz
cpython-fee69d0313afcbe38b4ac3803c70b7420f575f94.tar.bz2
Changed some comments. Removed the caution about clearing globs, since
clearing a shallow copy _run_examples() makes itself can't hurt anything.
-rw-r--r--Lib/doctest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index fb0334c..b59a68a 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -531,8 +531,6 @@ def _run_examples_inner(out, fakeout, examples, globs, verbose, name):
# Run list of examples, in a shallow copy of context (dict) globs.
# Return (#failures, #tries).
-# CAUTION: globs is cleared before returning. This is to help break
-# cycles that may have been created by the examples.
def _run_examples(examples, globs, verbose, name):
import sys
@@ -549,7 +547,9 @@ def _run_examples(examples, globs, verbose, name):
# generator tests that raise exceptions, because a named generator-
# iterator gets an entry in globs, and the generator-iterator
# object's frame's traceback info points back to globs. This is
- # easy to break just by clearing the namespace.
+ # easy to break just by clearing the namespace. This can also
+ # help to break other kinds of cycles, and even for cycles that
+ # gc can break itself it's better to break them ASAP.
globs.clear()
return x