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

Byte strings aren't docstrings #8350

Merged
merged 1 commit into from
Oct 30, 2023
Merged

Byte strings aren't docstrings #8350

merged 1 commit into from
Oct 30, 2023

Conversation

konstin
Copy link
Member

@konstin konstin commented Oct 30, 2023

We previously incorrectly treated byte strings in docstring position as docstrings because black does so (#8283 (comment), psf/black#4002), even CPython doesn't recognize them:

$ python3.12
Python 3.12.0 (main, Oct  6 2023, 17:57:44) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...     b""" a"""
...
>>> print(str(f.__doc__))
None

We previously incorrectly treated byte strings in docstring position as docstrings because black does so (#8283 (comment), psf/black#4002), even CPython doesn't recognize them:

```console
$ python3.12
Python 3.12.0 (main, Oct  6 2023, 17:57:44) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...     b""" a"""
...
>>> print(str(f.__doc__))
None
```
@MichaReiser MichaReiser added the formatter Related to the formatter label Oct 30, 2023
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

LGTM. Let's see if the ecosystem check finds any usages 😆

@github-actions
Copy link
Contributor

PR Check Results

Ecosystem

✅ ecosystem check detected no format changes.

@konstin konstin merged commit f483ed4 into main Oct 30, 2023
17 checks passed
@konstin konstin deleted the byte-strings-arent-docstrings branch October 30, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants