D7296: pycompat: kludge around pytype being confused by __new__

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Nov 15 12:33:22 EST 2019


durin42 updated this revision to Diff 18163.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7296?vs=18161&id=18163

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7296/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7296

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -154,7 +154,7 @@
     bytechr = struct.Struct('>B').pack
     byterepr = b'%r'.__mod__
 
-    class bytestr(bytes):
+    class bytestr(bytes): # type: Callable[[Union[bytes, str], bytestr]
         """A bytes which mostly acts as a Python 2 str
 
         >>> bytestr(), bytestr(bytearray(b'foo')), bytestr(u'ascii'), bytestr(1)
@@ -398,7 +398,7 @@
     unicode = unicode
     bytechr = chr
     byterepr = repr
-    bytestr = str
+    bytestr = str # type: Callable[[Union[bytes, str], bytestr]
     iterbytestr = iter
     maybebytestr = identity
     sysbytes = identity



To: durin42, #hg-reviewers, indygreg, dlax
Cc: mjpieters, dlax, indygreg, mercurial-devel


More information about the Mercurial-devel mailing list