Terry J. Reedy <tjreedy at udel.edu> added the comment:
The directives should normally be stripped, but not when they are intentionally given to teach their existence, syntax, and use, as in the doctest doc on directives.
I opened (and closed -- am trying to anyway) a duplicate, #14865. The problem of directive stripping started in 3.2.0 and subsequently 2.7.3 (after 2.7.2 in June 2011) and contiues in 3.3.0. Sandro Tosi noted
[1] https://bitbucket.org/birkenfeld/sphinx/issue/169/strip-doctest-csomments-in-rendered-output
[2] https://bitbucket.org/birkenfeld/sphinx/changeset/d91bf8e465ef
Issue and commit from June 2009.
My question is whether the added true-by-default ``trim_doctest_flags`` config value can just be added to doctest.rst? That would seem to be the point of having a settable config value, but I am ignorant of how sphinx works. I see that the patch does that, but also a lot more.
In any case, this is a nasty regression in the docs and should be fixed somehow before the next releases. It makes the examples actively confusing.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12947>
_______________________________________