Author Marc.Abramowitz
Recipients Marc.Abramowitz, dstufft, eric.araujo
Date 2014-12-16.07:58:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
`python check --restructuredtext --strict --metadata` fails with:

    warning: check: Could not finish the parsing.

if the RST document uses `code` or `code-block` directives.

This is annoying because the document is valid, but it appears to be invalid
and confuses people. For example, see

How to reproduce this bug

Clone a repo that has a `README.rst` with `code-block` directives in it. E.g.:

    $ git clone
    $ cd pytest-benchmark
    $ git checkout ab0b08f6fccb06a7909905a8409f8faa8b01e0d8

   Observe that it has "code-blocks" in it:

       $ grep 'code-block' README.rst
       .. code-block:: python
       .. code-block:: python

Observe that RST document is valid, according to ``:

       $ --halt=1 README.rst > README.html && echo "RST was OK."
       RST was OK.

       $ head -n 3 README.html
       <?xml version="1.0" encoding="utf-8" ?>
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
       <html xmlns="" xml:lang="en" lang="en">

Observe that `python check --restructuredtext --strict --metadata` fails:

    $ python check --restructuredtext --strict --metadata
    running check
    warning: check: Could not finish the parsing.

    error: Please correct your package.

    $ echo $?

**What was expected**: `python check --restructuredtext --strict
--metadata` should succeed with no warnings, just as ` did`, because
`README.rst` is a valid RST document.

**What actually happened**: `python check --restructuredtext --strict
--metadata` prints a warning and an error and fails, unlike ``

The error is coming from here:

It's happening because of this line:

    settings = frontend.OptionParser().get_default_values()

If this is changed to:

    settings = frontend.OptionParser(components=(Parser,)).get_default_values()

then things work much better (this is how `tools/` in docutils does it for example -- see

The attached patch prevents the failure from happening and also adds more information to the error when things go south.
Date User Action Args
2014-12-16 07:58:05Marc.Abramowitzsetrecipients: + Marc.Abramowitz, eric.araujo, dstufft
2014-12-16 07:58:05Marc.Abramowitzsetmessageid: <>
2014-12-16 07:58:05Marc.Abramowitzlinkissue23063 messages
2014-12-16 07:58:04Marc.Abramowitzcreate