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
It looks like there is a bug in merging configuration values from CLI and config file into the defaults. The default configuration has a null path entry:
virtualenv:
python: python2.7path: !!null
and the configuration merging algorithm takes care of several types, but does not take care of None values:
def_merge_dicts(self, left, right, path=None):
""" Merges right into left. Credit goes to: - https://stackoverflow.com/a/7205107/2721824 """ifpathisNone:
path= []
forkeyinright:
ifkeyinleft:
if (isinstance(left[key], dict)
andisinstance(right[key], dict)):
self._merge_dicts(left[key], right[key], path+ [str(key)])
elifleft[key] ==right[key]:
# same leaf valuepasselif (isinstance(left[key], (list, tuple))
andisinstance(right[key], (list, tuple))):
# TODO - Add unit tests# Let us make a copy to be safe (shallow).left[key] = [itemforiteminright[key]]
elif (isinstance(left[key], (str, int, float))
andisinstance(right[key], (str, int, float))):
# TODO - Add unit testsleft[key] =right[key]
else:
raiseValueError('Conflict at : {}'.format(
'.'.join(path+ [str(key)])))
else:
left[key] =right[key]
So if we try to override the virtualenv.path configuration key, we end up with a ValueError being raised.
Please consider replacing the if key in left: conditional to something like if key in left and left[key]:.
The text was updated successfully, but these errors were encountered:
Hi,
It looks like there is a bug in merging configuration values from CLI and config file into the defaults. The default configuration has a null path entry:
and the configuration merging algorithm takes care of several types, but does not take care of
None
values:So if we try to override the
virtualenv.path
configuration key, we end up with aValueError
being raised.Please consider replacing the
if key in left:
conditional to something likeif key in left and left[key]:
.The text was updated successfully, but these errors were encountered: