This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `python setup.py check --restructuredtext` fails when a include directive is present.
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cheryl.sabella, dstufft, eric.araujo, flying sheep, miss-islington
Priority: normal Keywords: patch

Created on 2017-08-28 13:57 by flying sheep, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
check-test.py 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 merged flying sheep, 2018-11-20 08:42
PR 12593 merged miss-islington, 2019-03-27 21:34
PR 12594 merged miss-islington, 2019-03-27 21:34
Messages (6)
msg300953 - (view) Author: (flying sheep) * Date: 2017-08-28 13:57
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.
msg301031 - (view) Author: (flying sheep) * Date: 2017-08-30 16:37
I should have linked the file: distutils/command/check.py
msg338987 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-03-27 21:34
New changeset d5a5a33f12b60129d57f9b423b77d2fcba506834 by Cheryl Sabella (Philipp A) in branch 'master':
bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)
https://github.com/python/cpython/commit/d5a5a33f12b60129d57f9b423b77d2fcba506834
msg338989 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-03-27 21:49
Thanks @flying sheep for the PR and @merwok for the review!
msg338990 - (view) Author: miss-islington (miss-islington) Date: 2019-03-27 22:23
New changeset 600aca47f085a06579e7af4c6423ea7e907b4bb4 by Miss Islington (bot) in branch '2.7':
bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)
https://github.com/python/cpython/commit/600aca47f085a06579e7af4c6423ea7e907b4bb4
msg338991 - (view) Author: miss-islington (miss-islington) Date: 2019-03-27 22:26
New changeset 9cad523328324bd82fa19b597ead1614a0e61ae2 by Miss Islington (bot) in branch '3.7':
bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)
https://github.com/python/cpython/commit/9cad523328324bd82fa19b597ead1614a0e61ae2
History
Date User Action Args
2022-04-11 14:58:51adminsetgithub: 75473
2019-03-27 22:26:00miss-islingtonsetmessages: + msg338991
2019-03-27 22:23:23miss-islingtonsetnosy: + miss-islington
messages: + msg338990
2019-03-27 21:49:22cheryl.sabellasetstatus: open -> closed
versions: + Python 2.7, Python 3.8, - Python 3.5, Python 3.6
messages: + msg338989

resolution: fixed
stage: patch review -> resolved
2019-03-27 21:34:51miss-islingtonsetpull_requests: + pull_request12537
2019-03-27 21:34:41miss-islingtonsetpull_requests: + pull_request12536
2019-03-27 21:34:22cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg338987
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