You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The codegen for augmented assignments (x += expr, x *= expr, etc.) evaluates the RHS expression twice when the target is a simple scalar variable.
In emit_AugAssign, the RHS is evaluated at line 3348 via rhs = adj.eval(node.value), but for simple ast.Name targets this result is unused â the code falls through to make_new_assign_statement() which rewrites the augmented assignment as x = x + expr via a new ast.BinOp node, re-evaluating node.value a second time.
Activity
shi-eric commentedon Feb 17, 2026
Added in 7af3419
Filed #1233 for more issues we should eventually fix.
Fix double evaluation of RHS in augmented assignments [NVIDIAGH-1230]
Merge branch 'adenzler/fix-augassign-double-eval' into 'main'
Fix double evaluation of RHS in augmented assignments [NVIDIAGH-1230]