Issue 31292: python setup.py check --restructuredtext fails when a include directive is present. (original) (raw)

If I have a setup.py containing a include directive, and use the command in the title, I get

Traceback (most recent call last): [...] File "/usr/lib/python3.6/site-packages/docutils/parsers/rst/directives/misc.py", line 59, in run source_dir = os.path.dirname(os.path.abspath(source)) File "/usr/lib/python3.6/posixpath.py", line 369, in abspath path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not _io.StringIO

The bug is in this method: distutils.command.check.check._check_rst_data

The first line already hints at it: source_path = StringIO()

StringIO instances aren’t paths, but at least the include directive (docutils.parsers.rst.directives.misc.Include) expects one.