# HG changeset patch # User Augie Fackler # Date 2017-03-03 19:42:56 # Node ID c920efa9d34b353a51afd75a2ff173fa411004e2 # Parent dc9842a7017c2e35177e44d5f963161c6a5325dd 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. diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -13,6 +13,7 @@ import os from .i18n import _ from . import ( error, + pycompat, util, ) @@ -69,6 +70,9 @@ class config(object): 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