Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fee69d0

Browse files
committed
Changed some comments. Removed the caution about clearing globs, since
clearing a shallow copy _run_examples() makes itself can't hurt anything.
1 parent d4ad59e commit fee69d0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/doctest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,6 @@ def _run_examples_inner(out, fakeout, examples, globs, verbose, name):
531531

532532
# Run list of examples, in a shallow copy of context (dict) globs.
533533
# Return (#failures, #tries).
534-
# CAUTION: globs is cleared before returning. This is to help break
535-
# cycles that may have been created by the examples.
536534

537535
def _run_examples(examples, globs, verbose, name):
538536
import sys
@@ -549,7 +547,9 @@ def _run_examples(examples, globs, verbose, name):
549547
# generator tests that raise exceptions, because a named generator-
550548
# iterator gets an entry in globs, and the generator-iterator
551549
# object's frame's traceback info points back to globs. This is
552-
# easy to break just by clearing the namespace.
550+
# easy to break just by clearing the namespace. This can also
551+
# help to break other kinds of cycles, and even for cycles that
552+
# gc can break itself it's better to break them ASAP.
553553
globs.clear()
554554
return x
555555

0 commit comments

Comments
 (0)