Closed matejsp closed 8 months ago
I think I have located the problematic part of code:
print(
'''Id,ProgramId,ProgramName,ProfileId,IpAddress,EventDate,MediaId,MediaName,AdId,AdName,AdType
"clickId1",14006,Test,"profileId1",ip1,2022-08-20T13:27:35+0200,1,"Joe Doeツ",adId1,Online,1
"clickId2",14006,Test,"profileId1",ip1,2022-08-20T13:39:51+0200,1,"Joe Doeツ",adId2,Online,2'''
)
save this under somename bla.py and run flake8 bla.py
Moving last ) to previous line ... fixes the problem (but black is not happy).
there's a bug in python 3.12.0 and 3.12.1 with multiline strings containing non-ascii characters -- would it be too much to ask if your error is fixed with the unreleased cpython main branch?
Yes I have tried and it works.
3.12.1 -> borked with IndexError: string index out of range
pyenv install 3.12-dev
3.12-dev -> runned OK
Any idea how to work around this or handle this error gracefully on every 3.12 version? Like ignoring the error or skipping the checks for such strings.
@matejsp when the underlying language is so broken that all prior versions and newer versions work, why would we attempt to fix such a narrow use-case when people are likely to get the fixed version? We can't possibly maintain tiny papercut fixes for every fundamental language flaw
The only reason that comes to my mind is that you can't get a working version of 3.12. Well not yet anyway. Not to mention waiting for distros to catchup. It will take another month to be relesed (every two months for bugfix release). And couple of months for all the distros.
I understand that you can't maintain papercut fixed for language flaws. But this is official and latest and current release of python. This is hinders the upgrade to latest python version (just my opinion anyway). If you would get something like false positive or negative it would be fine. But it completely crashes flake8 making it unusable. I see it more about making flake8 code more resiliant (even for unexpected input than maintaining papercut fixes).
Can you point me to upstream bug? Tried searching https://github.com/python/cpython/issues but was not able to find the issue. Is this specific to flake8 ast analysis or poses more deep runtime problem so whole python 3.12 should be avoided as a whole? If it would be so critial they would probably scrape the 3.12 release or make immediate hotfix.
this isn't the first time this has happened. 3.8.0 was also completely broken in some very niche cases that we can't really work around either
how did you install flake8?
unmodified output of
flake8 --bug-report
describe the problem
what I expected to happen
running flake8 -j 8 should just work on python 3.12 like it works on 3.11.
However it crashes: