Title: `python check --restructuredtext` fails when a include directive is present.
Type: behavior Stage: patch review
Components: Distutils Versions: Python 3.7, Python 3.6, Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, flying sheep
Priority: normal Keywords: patch

Created on 2017-08-28 13:57 by flying sheep, last changed 2018-11-20 08:42 by flying sheep.

File name Uploaded Description Edit flying sheep, 2017-08-28 13:57 Demo script for this issue
Pull Requests
URL Status Linked Edit
PR 3248 closed flying sheep, 2017-08-30 17:45
PR 10605 open flying sheep, 2018-11-20 08:42
Messages (2)
msg300953 - (view) Author: (flying sheep) * Date: 2017-08-28 13:57
If I have a 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/", line 59, in run
    source_dir = os.path.dirname(os.path.abspath(source))
  File "/usr/lib/python3.6/", 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.
msg301031 - (view) Author: (flying sheep) * Date: 2017-08-30 16:37
I should have linked the file: distutils/command/
Date User Action Args
2018-11-20 08:42:47flying sheepsetkeywords: + patch
stage: patch review
pull_requests: + pull_request9848
2018-07-11 07:48:25serhiy.storchakasettype: crash -> behavior
2017-08-30 17:45:43flying sheepsetpull_requests: + pull_request3293
2017-08-30 16:37:58flying sheepsetmessages: + msg301031
2017-08-28 13:57:45flying sheepcreate