Skip to content
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

fix formatting of literal in docstring of int.from_bytes and int.to_bytes #117847

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

jenshnielsen
Copy link
Contributor

The existing formatting causes a warning when building docs with sphinx that includes these docstrings. I ran into this issue when trying to build api docs of a subclass of enum.IntFlag with Sphinx configured to included docs from the super class. Here I am receiving errors like: WARNING: Inline interpreted text or phrase reference start-string without end-string.

I have not created an issue for this since it seems to fall under the trivial typo category. Let me know if that is wrong.

Copy link

cpython-cla-bot bot commented Apr 13, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Apr 13, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Apr 13, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@jenshnielsen
Copy link
Contributor Author

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

This seemed to be too trivial for a news entry but let me know if I am wrong

@jenshnielsen jenshnielsen force-pushed the fix_from_bytes_docstring branch from aa2fd3d to 428d96f Compare April 13, 2024 15:07
@bedevere-app
Copy link

bedevere-app bot commented Apr 13, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

In docstring of from_bytes and to_bytes. Use same char for start and end.
@jenshnielsen jenshnielsen force-pushed the fix_from_bytes_docstring branch from 428d96f to c5c9be3 Compare April 13, 2024 16:30
@bedevere-app
Copy link

bedevere-app bot commented Apr 13, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Objects/longobject.c Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) April 18, 2024 08:32
@JelleZijlstra JelleZijlstra merged commit 1539854 into python:main Apr 18, 2024
34 checks passed
@miss-islington-app
Copy link

Thanks @jenshnielsen for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @jenshnielsen and @JelleZijlstra, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 1539854c3d03c2d6287a150227ec4bef9de0bc2b 3.12

@encukou
Copy link
Member

encukou commented Apr 18, 2024

AFAIK this was intentional -- it's the traditional GNU quoting style. But yes, nowadays, it probably looks like a mistake to most people; even GNU projects tend to no longer recommend it.

@jenshnielsen jenshnielsen deleted the fix_from_bytes_docstring branch April 18, 2024 09:07
@JelleZijlstra
Copy link
Member

@encukou yes, I've seen it before too. I grepped through the codebase for other similar uses and there are a handful, including these that appear to be in docstrings:

Python/sysmodule.c:``Intern'' the given string.
Modules/cjkcodecs/multibytecodec.c:Return an encoded string version of `input'.
Modules/_heapqmodule.c:representation for a tournament.  The numbers below are `k', not a[k]:\n\
Modules/_heapqmodule.c:In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In\n\
Modules/_heapqmodule.c:a few applications, and I think it is good to keep a `heap' module\n\

geofft added a commit to geofft/cpython that referenced this pull request May 20, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings, error messages, etc.

I've left ./configure and friends alone because that isn't going to
impact downstream tools and feels like a lot of churn.
geofft added a commit to geofft/cpython that referenced this pull request May 20, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings, error messages, etc.

I've left ./configure and friends alone because that isn't going to
impact downstream tools and feels like a lot of churn.
geofft added a commit to geofft/cpython that referenced this pull request May 20, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings, error messages, etc.

I've left ./configure and friends alone because that isn't going to
impact downstream tools and feels like a lot of churn.
geofft added a commit to geofft/cpython that referenced this pull request May 20, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings, error messages, etc.

I've left ./configure and friends alone because that isn't going to
impact downstream tools and feels like a lot of churn.
geofft added a commit to geofft/cpython that referenced this pull request May 20, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
geofft added a commit to geofft/cpython that referenced this pull request May 21, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
geofft added a commit to geofft/cpython that referenced this pull request May 22, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
carljm pushed a commit that referenced this pull request May 22, 2024
As reported in #117847 and #115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
As reported in python#117847 and python#115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
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.

3 participants