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 object mydict was changed by the call to corner, which is unexpected.
This could be resolved by simply adding hist_kwargs = dict(hist_kwargs), because then the rest of the code is working on a copy of the dictionary. Of course the user could do this as well, but it would be nicer if the user wouldn't need to bother. Also, this becomes more annoying when passing this argument as a kwarg itself, because then a copy.deepcopy becomes necessary to ensure that what is passed in stays the same.
(If this will be implemented: If the default for hist_kwargs would not be None, but [], the if checking for None wouldn't also be needed anymore, because dict([]) gives an empty dictionary.)
The text was updated successfully, but these errors were encountered:
Thanks for the report! I'd be happy to review a PR that adds the appropriate copy, but please keep the same default value since some downstream dependencies rely on that behavior.
The current implementation of
corner_impl
is muting its mutable arguments, like here:The dictionary
hist_kwargs
as seen from the scope callingcorner
is changed after the call.Minimal example:
The object
mydict
was changed by the call tocorner
, which is unexpected.This could be resolved by simply adding
hist_kwargs = dict(hist_kwargs)
, because then the rest of the code is working on a copy of the dictionary. Of course the user could do this as well, but it would be nicer if the user wouldn't need to bother. Also, this becomes more annoying when passing this argument as a kwarg itself, because then acopy.deepcopy
becomes necessary to ensure that what is passed in stays the same.(If this will be implemented: If the default for
hist_kwargs
would not beNone
, but[]
, the if checking for None wouldn't also be needed anymore, becausedict([])
gives an empty dictionary.)The text was updated successfully, but these errors were encountered: