Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-121272: move async for/with validation from compiler to symtable #121361

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jul 4, 2024

Test are tested in test_bultin: test_compile_top_level_await_invalid_cases and test_compile_top_level_await.

@@ -251,6 +256,7 @@ static int symtable_visit_withitem(struct symtable *st, withitem_ty item);
static int symtable_visit_match_case(struct symtable *st, match_case_ty m);
static int symtable_visit_pattern(struct symtable *st, pattern_ty s);
static int symtable_raise_if_annotation_block(struct symtable *st, const char *, expr_ty);
static int symtable_raise_if_not_coroutine(struct symtable *st, const char *msg, _Py_SourceLocation loc);
Copy link
Contributor

@picnixz picnixz Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other functions have a signature that take the statement or expression as a parameter instead of the location directly. So maybe you could do the same here and just call LOCATION(s) when you call SET_ERROR_LOCATION?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would unnecessarily make this function specific to stmt_ty. There is likely to be an expr_ty luse case for it as well.

In general, a function is ideally passed what it actually needs (unless its purpose is to abstract something out).

@iritkatriel iritkatriel merged commit 67a05de into python:main Jul 4, 2024
38 checks passed
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants