mirror of
https://github.com/python/cpython.git
synced 2025-07-17 08:15:19 +00:00
gh-109118: Allow lambdas in annotation scopes in classes (#118019)
This commit is contained in:
parent
4c7bfdff90
commit
85f727c5fb
4 changed files with 53 additions and 13 deletions
|
@ -2140,17 +2140,6 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
|
|||
VISIT(st, expr, e->v.UnaryOp.operand);
|
||||
break;
|
||||
case Lambda_kind: {
|
||||
if (st->st_cur->ste_can_see_class_scope) {
|
||||
// gh-109118
|
||||
PyErr_Format(PyExc_SyntaxError,
|
||||
"Cannot use lambda in annotation scope within class scope");
|
||||
PyErr_RangedSyntaxLocationObject(st->st_filename,
|
||||
e->lineno,
|
||||
e->col_offset + 1,
|
||||
e->end_lineno,
|
||||
e->end_col_offset + 1);
|
||||
VISIT_QUIT(st, 0);
|
||||
}
|
||||
if (e->v.Lambda.args->defaults)
|
||||
VISIT_SEQ(st, expr, e->v.Lambda.args->defaults);
|
||||
if (e->v.Lambda.args->kw_defaults)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue