-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Internal error: AST change with bytes docstring #4002
Labels
T: bug
Something isn't working
Comments
konstin
added a commit
to astral-sh/ruff
that referenced
this issue
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: ```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 ```
konstin
added a commit
to astral-sh/ruff
that referenced
this issue
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: ```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 ``` <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? -->
JelleZijlstra
added a commit
to JelleZijlstra/black
that referenced
this issue
Oct 30, 2023
Fixes psf#4002 I think this only fixes crashes so it doesn't need to go through the preview style, but not 100% sure.
hauntsaninja
pushed a commit
that referenced
this issue
Nov 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Black reformats the contents of triple quoted byte strings in docstring position, even though those are not docstrings, causing a crash due to AST changes:
Surprisingly, the empty line rules for class level docstrings look already correct.
Confirmed to occur on 23.10.1 and main (f7cbe4a) with the playground.
The text was updated successfully, but these errors were encountered: