@@ -1488,11 +1488,42 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
1488
1488
if (s -> v .AsyncFunctionDef .args -> kw_defaults )
1489
1489
VISIT_SEQ_WITH_NULL (st , expr ,
1490
1490
s -> v .AsyncFunctionDef .args -> kw_defaults );
1491
+ if (s -> v .AsyncFunctionDef .decorator_list )
1492
+ VISIT_SEQ (st , expr , s -> v .AsyncFunctionDef .decorator_list );
1493
+ if (s -> v .AsyncFunctionDef .typeparams ) {
1494
+ if (!symtable_enter_block (st , s -> v .AsyncFunctionDef .name ,
1495
+ FunctionBlock , (void * )s -> v .AsyncFunctionDef .typeparams ,
1496
+ LOCATION (s ))) {
1497
+ VISIT_QUIT (st , 0 );
1498
+ }
1499
+ if (s -> v .AsyncFunctionDef .args -> defaults ) {
1500
+ PyObject * defaults_name = PyUnicode_FromString (".defaults" );
1501
+ if (defaults_name == NULL ) {
1502
+ VISIT_QUIT (st , 0 );
1503
+ }
1504
+ if (!symtable_add_def (st , defaults_name , DEF_PARAM , LOCATION (s ))) {
1505
+
8000
Py_DECREF (defaults_name );
1506
+ VISIT_QUIT (st , 0 );
1507
+ }
1508
+ Py_DECREF (defaults_name );
1509
+ }
1510
+ if (has_kwonlydefaults (s -> v .AsyncFunctionDef .args -> kwonlyargs ,
1511
+ s -> v .AsyncFunctionDef .args -> kw_defaults )) {
1512
+ PyObject * kwonly_name = PyUnicode_FromString (".kwonlydefaults" );
1513
+ if (kwonly_name == NULL ) {
1514
+ VISIT_QUIT (st , 0 );
1515
+ }
1516
+ if (!symtable_add_def (st , kwonly_name , DEF_PARAM , LOCATION (s ))) {
1517
+ Py_DECREF (kwonly_name );
1518
+ VISIT_QUIT (st , 0 );
1519
+ }
1520
+ Py_DECREF (kwonly_name );
1521
+ }
1522
+ VISIT_SEQ (st , typeparam , s -> v .AsyncFunctionDef .typeparams );
1523
+ }
1491
1524
if (!symtable_visit_annotations (st , s , s -> v .AsyncFunctionDef .args ,
1492
1525
s -> v .AsyncFunctionDef .returns ))
1493
1526
VISIT_QUIT (st , 0 );
1494
- if (s -> v .AsyncFunctionDef .decorator_list )
1495
- VISIT_SEQ (st , expr , s -> v .AsyncFunctionDef .decorator_list );
1496
1527
if (!symtable_enter_block (st , s -> v .AsyncFunctionDef .name ,
1497
1528
FunctionBlock , (void * )s ,
1498
1529
s -> lineno , s -> col_offset ,
@@ -1503,6 +1534,10 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
1503
1534
VISIT_SEQ (st , stmt , s -> v .AsyncFunctionDef .body );
1504
1535
if (!symtable_exit_block (st ))
1505
1536
VISIT_QUIT (st , 0 );
1537
+ if (s -> v .AsyncFunctionDef .typeparams ) {
1538
+ if (!symtable_exit_block (st ))
1539
+ VISIT_QUIT (st , 0 );
1540
+ }
1506
1541
break ;
1507
1542
case AsyncWith_kind :
1508
1543
VISIT_SEQ (st , withitem , s -> v .AsyncWith .items );
0 commit comments