'pycharm ide gives syntax error with python 3.10 but code is working fine

hi I just installed windows 11 and python 3.10 and pycharm 2021.2.2 now when I use python 3.10 in pycharm and use some new features in python 3.10 i get some highlight in my code but the code is working fine here is what I'm experiencing :

syntax error highlight in pycharm 2021.2 and python 3.10

i really don't have any idea to how to fix it help please



Solution 1:[1]

Try removing the parenthesis, and:

with open(file = "file1") as file1, open(file="file2") as file2:
    print(file1)
    print(file2)

Works for me, p.s. I'm using PyCharm 2021.2.2 Professional Edition on Ubuntu.

Solution 2:[2]

As mentioned by Pavel Karateev in the comments, this is a bug in PyCharm, still as of 2022-03-09.

All we can do is vote for and await the resolution of issue PY-42200.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shaheer Hassan
Solution 2 gertvdijk