You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mypy always fails with Python 3.10 match statement #11829
Reacted by Pavel Zhukov, Julian Torres, Edward Knight, Ruslan Gilfanov, Sergey Parhomenko, cgp-iac, Denis Langer, João Paulo Taylor Ienczak Zanette, resister, Harish Rajagopal and 12 more
@srittau downgraded to mypy 0.910, the error is still the same
$ mypy -V && mypy t5.py
mypy 0.910
t5.py:2: error: Match statement is not supported [syntax]
Found 1 error in 1 file (errors prevented further checking)
Reacted by ZosiaTab, Stijn Derks, Michael Palarya, Timon Schmelzer, Fabián Heredia Montiel, Adam Matan and gmanka
@srittau is there a way to properly ignore the match section as a temporary solution?
OP's attempt does not seem to work on either 0.910 and 0.931 versions
Reacted by simensol, Anton Lazarev, Fabián Heredia Montiel, Michael Palarya, Andrea Censi and Tommy Carpenter
When this is going to be available on pypi? I am still having issues with my build using the latest version.
As have I unfortunately...
I've tried adding # type: ignore to various parts of code blocks just in case perhaps there was some sort of bug causing said phrase to function incorrectly or in different positions, but no dice.
Are there any sort of temporary fixes in the meantime, or do I just need to ignore the red squiggles in my IDE for now, lol?
When this is going to be available on pypi? I am still having issues with my build using the latest version.
As have I unfortunately...
I've tried adding # type: ignore to various parts of code blocks just in case perhaps there was some sort of bug causing said phrase to function incorrectly or in different positions, but no dice.
Are there any sort of temporary fixes in the meantime, or do I just need to ignore the red squiggles in my IDE for now, lol?
I've tried adding # type: ignore to various parts of code blocks just in case perhaps there was some sort of bug causing said phrase to function incorrectly or in different positions, but no dice.
Are there any sort of temporary fixes in the meantime, or do I just need to ignore the red squiggles in my IDE for now, lol?
While there is no release you can install mypy on the commit that includes this initial support for match statements:
I can absolutely appreciate that mypy needs time to support newer features. I'm confused on the choice here, though, to return an error. What is the reasoning behind classifying the result this way?
I'm relying on mypy to type-check my code. If I'm using language features that mypy does not support, I think it's good to receive a warning in places where I cannot rely on it.
The fact that you couldn't suppress the warning was bad, but probably an honest mistake.
Certainly agree with the warning. It would be awkward to just have mypy be silent when it can't process some syntax at all. If the fact that it raises an error was in error, that's certainly my misunderstanding of the issue here. Thanks! 👍
As have I unfortunately...
I've tried adding # type: ignore to various parts of code blocks just in case perhaps there was some sort of bug causing said phrase to function incorrectly or in different positions, but no dice.
Are there any sort of temporary fixes in the meantime, or do I just need to ignore the red squiggles in my IDE for now, lol?
While there is no release you can install mypy on the commit that includes this initial support for match statements:
Any updates on this? I'm using mypy 1.3.0 and this is still throwing the error error: Pattern matching is only supported in Python 3.10 and greater [syntax]
Activity
srittau commentedon Dec 23, 2021
The match statement is not yet supported in mypy. See #10191.
wrobell commentedon Dec 23, 2021
@srittau That's OK. I am just asking Mypy to ignore match block, but it still raises the error.
It seems it could be trivial to make it to respect "type: ignore"?
mypy/mypy/fastparse.py
Lines 1289 to 1293 in 9e34f6a
Revert "switch to switch case"
srittau commentedon Jan 3, 2022
That indeed seems like a regression. At least in mypy 0.910, the match statement could be ignored.
jarek-webellian commentedon Jan 4, 2022
@srittau downgraded to mypy 0.910, the error is still the same
MPalarya commentedon Jan 9, 2022
@srittau is there a way to properly ignore the
matchsection as a temporary solution?OP's attempt does not seem to work on either 0.910 and 0.931 versions
srittau commentedon Jan 9, 2022
I'm not sure. I thought it had worked for me with 0.910, but when I downgraded, it failed too.
intgr commentedon Jan 18, 2022
Looks like proper
matchsupport is pretty close to merging (#10191), so I guess it makes sense to just wait it out?JelleZijlstra commentedon Jan 18, 2022
It has been merged
lenoqt commentedon Jan 19, 2022
When this is going to be available on pypi? I am still having issues with my build using the latest version.
JelleZijlstra commentedon Jan 19, 2022
There are no concrete plans for the next release yet.
WIP: mypy disabled until python/mypy#11829 gets pushed into pypi
WIP: mypy disabled until python/mypy#11829 gets pushed into pypi
WIP: mypy disabled until python/mypy#11829 gets pushed into pypi
JukkaL commentedon Jan 19, 2022
I'm hoping that we will have a feature release sometime in February.
JukkaL commentedon Jan 19, 2022
This issue can be used to track progress on the next feature release which will support the match statement:
schlopp96 commentedon Jan 20, 2022
As have I unfortunately...
I've tried adding
# type: ignoreto various parts of code blocks just in case perhaps there was some sort of bug causing said phrase to function incorrectly or in different positions, but no dice.Are there any sort of temporary fixes in the meantime, or do I just need to ignore the red squiggles in my IDE for now, lol?
lenoqt commentedon Jan 21, 2022
I had to disable mypy until this gets released.
gdalmau commentedon Jan 21, 2022
While there is no release you can install mypy on the commit that includes this initial support for match statements:
The commit above is the first commit after 9b63751 where the CI succeeds.
jeremytwfortune commentedon Feb 2, 2022
I can absolutely appreciate that mypy needs time to support newer features. I'm confused on the choice here, though, to return an error. What is the reasoning behind classifying the result this way?
intgr commentedon Feb 2, 2022
I'm relying on mypy to type-check my code. If I'm using language features that mypy does not support, I think it's good to receive a warning in places where I cannot rely on it.
The fact that you couldn't suppress the warning was bad, but probably an honest mistake.
jeremytwfortune commentedon Feb 2, 2022
Certainly agree with the warning. It would be awkward to just have mypy be silent when it can't process some syntax at all. If the fact that it raises an error was in error, that's certainly my misunderstanding of the issue here. Thanks! 👍
SerGeRybakov commentedon Feb 7, 2022
It's good to have an option to install from git branch to local. But it doesn't solve pre-commit hooks problems.
Waiting for a soonest release!
aomayden commentedon May 11, 2023
Any updates on this? I'm using mypy 1.3.0 and this is still throwing the error
error: Pattern matching is only supported in Python 3.10 and greater [syntax]hauntsaninja commentedon May 11, 2023
That probably means you're not running mypy with Python 3.10 or newer (or you're not actually running mypy 1.3). Try
python3.10 -m mypyaomayden commentedon May 12, 2023
Yes, you're right. I hadn't updated my .mypy.ini from a previous project to state python_version=3.10. Thank you!
larroy commentedon Nov 4, 2023
I still have this in mypy 1.6.1 for mac.
error: Pattern matching is only supported in Python 3.10 and greaterPython 3.10.13
mypy 1.6.1