File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
python/upgrades/f635b392038a494915307f913657cd3058f9b476 Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -139,11 +139,15 @@ where
139139 newidx = oldidx + count ( callable .getInnerScope ( ) .getArg ( _) ) - count ( args .getDefault ( _) )
140140 )
141141 or
142- // expr is a default for a keyword-only parameter
142+ // expr is a default for a keyword-only parameter.
143+ // before this upgrade, we would not always attach the default value to the correct keyword-only parameter,
144+ // to fix this, we calculate the new index based on the source location of the default value (a default value
145+ // must belong to the parameter that was defined immediately before the default value).
143146 exists ( Arguments_ args , CallableExprAdjusted callable |
144147 callable .getArgs ( ) = args and
145148 args .getKwDefault ( oldidx ) = expr and
146149 newidx =
150+ // the last parameter to be defined before this default value
147151 max ( int i |
148152 exists ( Parameter_ param | param = callable .getInnerScope ( ) .getKwonlyarg ( i ) |
149153 param .getLocation ( ) .getStartLine ( ) < expr .getLocation ( ) .getStartLine ( )
You can’t perform that action at this time.
0 commit comments