[Python-Dev] unsupported doctest directives in Doc/library/ctypes.rst

Chris Jerdonek chris.jerdonek at gmail.com
Thu Sep 13 15:25:52 CEST 2012

In the process of studying the global state of our doctests, I noticed
that the doctests in Doc/library/ctypes.rst use the following doctest

# doctest: +LINUX
# doctest: +WINDOWS

However, I'm not able to find evidence that these directives are
implemented anywhere.  Thus I get an error like the following when
trying to parse the file using doctest:

"ValueError: line 55 of the doctest for ctypes.rst has an invalid
option: '+WINDOWS'"

The reST file says this towards the top:

"Note: The code samples in this tutorial use :mod:`doctest` to make sure that
they actually work.  Since some code samples behave differently under Linux,
Windows, or Mac OS X, they contain doctest directives in comments.""

The farthest back I was able to trace this paragraph was here from April 2006:


in which the docs seem to have been added from reST sources outside
the repository (from ctypes upstream -- see the parent

I would like for our docs to be parseable by doctest without error.
Possible options seem to include at least (1) changing these
directives to normal code comments until we can support these
directives in a meaningful way, and (2) calling
doctest.register_optionflag() for these directives as no-ops as
appropriate to make the errors go away.

Does anyone have any thoughts on this?


More information about the Python-Dev mailing list