File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1192,8 +1192,15 @@ def get_expr_length(expr: Expression) -> int | None:
11921192 if isinstance (expr , (StrExpr , BytesExpr )):
11931193 return len (expr .value )
11941194 elif isinstance (expr , (ListExpr , TupleExpr )):
1195- if all (get_expr_length (i ) is not None for i in expr .items ):
1196- return len (expr .items )
1195+ # if there are no star expressions, or we know the length of them,
1196+ # we know the length of the expression
1197+ stars = [get_expr_length (i , context ) for i in expr .items if isinstance (i , StarExpr )]
1198+ if None not in stars :
1199+ other = sum (not isinstance (i , StarExpr ) for i in expr .items )
1200+ return other + sum (stars )
1201+ elif isinstance (expr , StarExpr ):
1202+ # star expression needs some extra logic but that can come later, this is good for now
1203+ pass
11971204 # TODO: extend this, unrolling should come with a good performance boost
11981205 return None
11991206
You can’t perform that action at this time.
0 commit comments