Skip to content

Byte strings aren't docstrings#8350

Merged
konstin merged 1 commit intomainfrom
byte-strings-arent-docstrings
Oct 30, 2023
Merged

Byte strings aren't docstrings#8350
konstin merged 1 commit intomainfrom
byte-strings-arent-docstrings

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
@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