[3.10] bpo-46004: Fix error location for loops with invalid targets (GH-29959). (GH-29961)

(cherry picked from commit 1c7a1c3be08ee911d347fffd2716f3911ba751f9)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
3 files changed