Mercurial > hg
changeset 31306:c920efa9d34b
config: guard against setconfig specifying unicode values on py3
This was leading to some difficult to trace problems because the
values were set in one place, but then blew up much later in the
program. Exploding violently with an assertion seems reasonable here.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 03 Mar 2017 14:42:56 -0500 |
parents | dc9842a7017c |
children | f8d41edd0357 |
files | mercurial/config.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/config.py Fri Mar 03 14:43:27 2017 -0500 +++ b/mercurial/config.py Fri Mar 03 14:42:56 2017 -0500 @@ -13,6 +13,7 @@ from .i18n import _ from . import ( error, + pycompat, util, ) @@ -69,6 +70,9 @@ def items(self, section): return self._data.get(section, {}).items() def set(self, section, item, value, source=""): + if pycompat.ispy3: + assert not isinstance(value, str), ( + 'config values may not be unicode strings on Python 3') if section not in self: self._data[section] = util.sortdict() self._data[section][item] = value