~pyflakes-dev/pyflakes/master

Viewing all changes in revision 202.

  • Committer: John Vandenberg
  • Date: 2015-11-24 13:05:38 UTC
  • Revision ID: git-v1:6734c37970a6a2424c4289f0986f242f66851fbb
Process doctest scope directly under the module scope

Explicitly place the doctest directly under the module scope,
instead of processing it while within the scope where the
docstring was encountered.
Also do not process doctest which are not processed by default
according to the doctest documentation.

The primary benefit of moving the doctest scope directly under
the module scope is that it may be efficiently identified,
as it may only appear second in the stack.

However it also ensures that the doctest scope can not access
names in scopes between the module scope and the object where the
docstring was encountered.  As it was, class scope rules prevented
the doctest scope from accessing names in a class scope, however
the doctest scope was able to access names in an outer function,
if the doctest appeared in a nested function.
Note that there was no real bug there, as the doctest module does
not process doctest in nested functions (Python issue #1650090),
so doctest appearing in nested functions are informational only.
pyflakes previously inspected doctest in nested functions,
and now these are ignored.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: