There is a known bug in PyCharm, related to Python 3.10: https://youtrack.jetbrains.com/issue/PY-54447/
This only appears in Debug mode.
For me, downgrading to Python 3.9 worked as a workaround until the issue is fixed.
If this is your case, you can give it a try.