Patchwork [06,of,12,py3] manifest: ensure paths are bytes (not str) in pure parser

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 7:49 p.m.
Message ID <5a0a53d127726a34013a.1489348195@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19222/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 7:49 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489303914 14400
#      Sun Mar 12 03:31:54 2017 -0400
# Node ID 5a0a53d127726a34013a34156d47ab873f6dc8df
# Parent  9b0c4bba327a1c1809fc5e7da184c695561e272c
manifest: ensure paths are bytes (not str) in pure parser

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -255,8 +255,8 @@  class _lazymanifest(object):
         return self.data[start:end]
 
     def __getitem__(self, key):
-        if not isinstance(key, str):
-            raise TypeError("getitem: manifest keys must be a string.")
+        if not isinstance(key, bytes):
+            raise TypeError("getitem: manifest keys must be a bytes.")
         needle = self.bsearch(key)
         if needle == -1:
             raise KeyError