diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -542,7 +542,7 @@ emptydirs = [] h = dirs[d] while isinstance(h, dict) and len(h) == 1: - k, v = h.items()[0] + k, v = next(iter(h.items())) if v: emptydirs.append(k) h = v