Message 325083 - Python tracker
Because this issue describes two different problems, I'm going to close it. The part of it that involves errors during the evaluation of a syntactically valid expression was at least partially fixed in #30465. I will probably re-work how this fix was implemented. I'm working on the syntax error part of it in #34364.