Skip to content

Add extra newline in io.BytesIO.seek() to prevent a Sphinx warning #29519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

janlugt
Copy link

@janlugt janlugt commented Nov 11, 2021

When generating documentation with Sphinx for one of my projects, I get a warning for documentation inherited from BytesIO. The code for the class is very simple:

class BlobFile(io.BytesIO):
  pass

my_class.py:docstring of MyClass.seek:7: WARNING: Definition list ends without a blank line; unexpected unindent.

This would be fixed with an extra newline in the documentation for BytesIO.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@janlugt

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@janlugt
Copy link
Author

janlugt commented Nov 11, 2021

CLA has been signed, should be processed by tomorrow.

@janlugt janlugt marked this pull request as draft November 11, 2021 10:48
@janlugt janlugt marked this pull request as ready for review November 12, 2021 09:52
@akulakov
Copy link
Contributor

akulakov commented Dec 4, 2021

Jan: in this PR, the blank line is added in a C source file instead of docs file.

@janlugt
Copy link
Author

janlugt commented Dec 4, 2021

That's correct, but these chunks of documentation do make it into the class documentation for io.BytesIO, and thus into sphinx-generated documentation for subclasses created from it.

Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant hurt

@ghost
Copy link

ghost commented Apr 17, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Every change to Python requires a NEWS entry.

Please, add it using the blurb_it Web app or the blurb command-line tool.

Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@JulienPalard
Copy link
Member

At first glance it does not seems to fix the issue (try by simply copying-pasting the docstring to a rst file, but it does not looks like a reStructuredText list even after the newline being added).

But beware: Python docstrings are not intended to be valid reStructuredText, so using autodoc with :inherited-members: with cpython classes as parents is just not supported.

By fixing one, you're opening the path to rewrite all Python docstrings, this is a monumental amount of work that can't be done without first raising the idea on python-ideas@, it getting traction, speaking about it on python-dev@, having PEP 7, PEP 8 and PEP 257 amended... but I personally don't think we'll ever see Sphinx roles in docstrings (who want to see sphinx roles when using help(...) from an interpreter?).

So I'm sadly just closing this PR. But thanks @janlugt for the good intention of fixing something and having taken the time to open a PR, this is greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants