# HG changeset patch # User Yuya Nishihara # Date 1501681879 -32400 # Node ID 524b13fc711f76343557f054d2a11678ef83f8c8 # Parent 6788e648efcfde237bca8fa22794c8fc5c64c502 util: fix sortdict.update() to call __setitem__() on PyPy (issue5639) It appears that overriding __setitem__() doesn't work as documented on PyPy. Let's patch it as before bd0fd3ff9916. https://docs.python.org/2/library/collections.html#ordereddict-examples-and-recipes The issue was ui.configitems() wasn't ordered correctly, so the pull command was wrapped in different order. diff -r 6788e648efcf -r 524b13fc711f mercurial/pycompat.py --- a/mercurial/pycompat.py Wed Aug 02 22:58:38 2017 +0900 +++ b/mercurial/pycompat.py Wed Aug 02 22:51:19 2017 +0900 @@ -16,6 +16,7 @@ import sys ispy3 = (sys.version_info[0] >= 3) +ispypy = (r'__pypy__' in sys.builtin_module_names) if not ispy3: import cookielib diff -r 6788e648efcf -r 524b13fc711f mercurial/util.py --- a/mercurial/util.py Wed Aug 02 22:58:38 2017 +0900 +++ b/mercurial/util.py Wed Aug 02 22:51:19 2017 +0900 @@ -584,6 +584,14 @@ del self[key] super(sortdict, self).__setitem__(key, value) + if pycompat.ispypy: + # __setitem__() isn't called as of PyPy 5.8.0 + def update(self, src): + if isinstance(src, dict): + src = src.iteritems() + for k, v in src: + self[k] = v + @contextlib.contextmanager def acceptintervention(tr=None): """A context manager that closes the transaction on InterventionRequired