-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
On Apple M1, Black often drops the ":9]=" out of f"{...[:9]=}", as Internal Error #4446
Comments
Hm, that's pretty surprising to me. I can't repro on a similar M1 2021 Macbook Pro. Does it repro if you run the following script?
|
Thank you Ouch, technically, I can't run your script literally as shown on my vanilla-ish MacBook with its Apple M1 Pro because I lack "python" =>
But I can run the script when I patch it to start with python3 in place of python
And then, true, three times in a row was Not enough to repro. The first time I ran this, I was that unlucky, same as you. But I kept on trying. Eventually I did repro INTERNAL ERROR once more. As shown here =>
You can see this latest repro calls out /var/folders/6j/yj_0gg5d7dg02zhp0vwfx0580000gp/T/blk_t1xbcxf8.log That File came out as
You were correct to guess that I didn't know enough to compose your script myself, but I feel I do understand it now that you show it to me : Sorry I was wrong to suggest we try calling Black 3 times, not 9 times I'd vote we patch your script to try 9 times
Now, when I run the script, it fails every run at my MacBook with its Apple M1 Pro 4 Fails in 9 Tries Something like that. Exactly which try fails and which try passes bounces all around. Sometimes I see Pass Fail Pass. Sometimes I see Pass Fail Fail Fail Pass. Or Pass Fail Fail Pass. And so on and on : I rebooted my MacBook last night, just to see if that would change my rates of repro. But my reboot didn't change my feel of rates of repro. To me, it feels about as easy and hard to repro to me, same afterwards as before : Thank you for believing I could help. Am I helping? Can I help more? |
Thanks, this is quite mysterious, I still don't have a repro. Let me try a few things and get back to you... |
Okay, I think this is a regression in Python itself (!) |
Bisected and reported upstream here: python/cpython#123821 Thanks for the report and helping me reproduce the error! |
Fixes psf#4446 See python/cpython#123821 It's possible this is too strict? We could instead do this anytime the AST safety check fails, but feels weird to have that happen non-deterministically
Congratulations, and thank you : -) |
Describe the bug
Black running on M1 MacBooks does drop a few Characters of Python Source Code, when given these particular 120 Characters, but only sometimes. Sometimes you call Black and it works. Sometimes you call, and it chokes
To Reproduce
Visit an M1 MacBook and feed these 4 Lines of Python Code into Black
For example, take these 4 Lines, formatted exactly as shown
And try calling Black, more than once, on this same input with no arguments
The resulting error is:
It drops the : 9 ] = part of the F String Slice. Oops
Expected behavior
No Internal Error
Environment
Additional context
Below is a Terminal transcript of reproducing this occasional Internal Error
Look closely and you'll see some runs on the same input fail like this, but some runs don't fail. This bug combines ( a ) that the results can and are inconsistent, and ( b ) that some of the results are Internal Errors
This Bug only repros for me on my M1 MacBook
I've not found anywhere else where it will repro. I tried a Linux, but it didn't repro there. Every time I've tried it three times in a row at my M1 MacBook, I do repro 1 or 2 or 3 Failures
I first saw this go boom on 962 Lines
Thank you for believing I could help. Am I helping? Can I help more?
The text was updated successfully, but these errors were encountered: