# HG changeset patch # User Georges Racinet # Date 2019-10-10 09:33:33 # Node ID 3c6976b1f693d1e514fc96b20813e6e5259daecd # Parent 9d57c2df7b5f6a37234877863256bc4b295fbdb0 py3-discovery: using plain str in stats dict rust-cpython converts automatically from Rust strings to the appropriate `str` for the target Python version. Insisting on discovery stats dict keys to be bytes hence breaks the process (this is spotted by test-setdiscovery.t). Now that byteify-strings has been run on the entire codebase, and the import transformer is not there any more, the simplest fix is to make the keys plain str again. Another possible fix would be to forcefully convert to bytes in rust-cpython code, but that feels less natural, and would probably have to be reverted down the road. Differential Revision: https://phab.mercurial-scm.org/D7039 diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -176,7 +176,7 @@ class partialdiscovery(object): def stats(self): return { - b'undecided': len(self.undecided), + 'undecided': len(self.undecided), } def commonheads(self): @@ -441,7 +441,7 @@ def findcommonheads( stats = disco.stats() ui.debug( b"query %i; still undecided: %i, sample size is: %i\n" - % (roundtrips, stats[b'undecided'], len(sample)) + % (roundtrips, stats['undecided'], len(sample)) ) # indices between sample and externalized version must match