Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def testSyntaxErrorOffset(self):
check("ages = {'Alice'=22, 'Bob'=23}", 1, 16)
check('match ...:\n case {**rest, "key": value}:\n ...', 2, 19)
check("[a b c d e f]", 1, 2)
check("for x yfff:", 1, 7)

# Errors thrown by compile.c
check('class foo:return 1', 1, 11)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix the :exc:`SyntaxError` location for errors involving for loops with
invalid targets. Patch by Pablo Galindo
3 changes: 2 additions & 1 deletion 3 Parser/pegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ _RAISE_SYNTAX_ERROR_INVALID_TARGET(Parser *p, TARGETS_TYPE type, void *e)
msg,
_PyPegen_get_expr_name(invalid_target)
);
return RAISE_SYNTAX_ERROR_KNOWN_LOCATION(invalid_target, "invalid syntax");
}
return RAISE_SYNTAX_ERROR("invalid syntax");
return NULL;
}

// Action utility functions
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.