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

--experimental-string-processing crash on string + % { #2271

Closed
JelleZijlstra opened this issue May 29, 2021 · 4 comments · Fixed by #2283
Closed

--experimental-string-processing crash on string + % { #2271

JelleZijlstra opened this issue May 29, 2021 · 4 comments · Fixed by #2283
Labels
C: crash Black is crashing F: strings Related to our handling of strings T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

% cat legacy.py                                   

def _legacy_listen_examples():
    text += (
        "    \"listen for the '%(event_name)s' event\"\n"
        "\n    # ... (event logic logic logic) ...\n"
        % {
            "since": since,
        }
    )
% black --experimental-string-processing legacy.py
error: cannot format legacy.py: Apparently, old parentheses do NOT exist?!
Oh no! 💥 💔 💥
1 file failed to reformat.

Minified from a file in sqlalchemy that we originally found this crash on.

The crash is in the StringParenWrapper class in trans.py, which apparently doesn't know how to handle the parentheses enclosing the string + % {. I spent some time looking at it but I'm not sure what the best solution is.

@JelleZijlstra JelleZijlstra added C: crash Black is crashing F: strings Related to our handling of strings labels May 29, 2021
@ichard26 ichard26 added T: bug Something isn't working and removed C: crash Black is crashing F: strings Related to our handling of strings labels May 29, 2021
@ichard26
Copy link
Collaborator

What even... apparently I opened the label selection menu at the worse time ever that I cleared the labels... AHHH

@ichard26 ichard26 added C: crash Black is crashing F: strings Related to our handling of strings labels May 29, 2021
@JelleZijlstra
Copy link
Collaborator Author

@bbugyi200 would you still be interested in fixing this one? Right now it's the only --experimental-string-processing crash we're aware of.

@bbugyi200
Copy link
Contributor

bbugyi200 commented May 30, 2021

@JelleZijlstra Thanks for tagging me. The follownig PR should fix this crash: #2283

@JelleZijlstra
Copy link
Collaborator Author

Thank you! I really appreciate you helping out with all of these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: crash Black is crashing F: strings Related to our handling of strings T: bug Something isn't working
Projects
None yet
3 participants