Patchwork ***UNCHECKED*** D7230: py3: don't use bytes with vars() or __dict__

login
register
mail settings
Submitter phabricator
Date Nov. 5, 2019, 5:18 p.m.
Message ID <differential-rev-PHID-DREV-mnksxqa6uplqfnx75jxu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42755/
State Superseded
Headers show

Comments

phabricator - Nov. 5, 2019, 5:18 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Inspired by D7227 <https://phab.mercurial-scm.org/D7227>. These were all the remaining instances I could
  find.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  contrib/perf.py
  hgext/fastannotate/context.py
  hgext/mq.py
  mercurial/bundle2.py
  mercurial/localrepo.py
  mercurial/merge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -171,7 +171,7 @@ 
         self._local = None
         self._other = None
         self._labels = labels
-        for var in (b'localctx', b'otherctx'):
+        for var in ('localctx', 'otherctx'):
             if var in vars(self):
                 delattr(self, var)
         if node:
@@ -196,7 +196,7 @@ 
         self._stateextras = {}
         self._local = None
         self._other = None
-        for var in (b'localctx', b'otherctx'):
+        for var in ('localctx', 'otherctx'):
             if var in vars(self):
                 delattr(self, var)
         self._readmergedriver = None
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3199,7 +3199,7 @@ 
         # When using the same lock to commit and strip, the phasecache is left
         # dirty after committing. Then when we strip, the repo is invalidated,
         # causing those changes to disappear.
-        if b'_phasecache' in vars(self):
+        if '_phasecache' in vars(self):
             self._phasecache.write()
 
     @unfilteredmethod
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -857,7 +857,7 @@ 
         needed to move forward to get general delta enabled.
         """
         yield self._magicstring
-        assert b'params' not in vars(self)
+        assert 'params' not in vars(self)
         paramssize = self._unpack(_fstreamparamsize)[0]
         if paramssize < 0:
             raise error.BundleValueError(
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -567,7 +567,7 @@ 
         return self.seriesguards
 
     def invalidate(self):
-        for a in b'applied fullseries series seriesguards'.split():
+        for a in 'applied fullseries series seriesguards'.split():
             if a in self.__dict__:
                 delattr(self, a)
         self.applieddirty = False
diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py
--- a/hgext/fastannotate/context.py
+++ b/hgext/fastannotate/context.py
@@ -57,7 +57,7 @@ 
     # renamed filectx won't have a filelog yet, so set it
     # from the cache to save time
     for p in pl:
-        if not b'_filelog' in p.__dict__:
+        if not '_filelog' in p.__dict__:
             p._filelog = _getflog(f._repo, p.path())
 
     return pl
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -691,8 +691,8 @@ 
         def clearcache():
             # _tagscache has been filteredpropertycache since 2.5 (or
             # 98c867ac1330), and delattr() can't work in such case
-            if b'_tagscache' in vars(repo):
-                del repo.__dict__[b'_tagscache']
+            if '_tagscache' in vars(repo):
+                del repo.__dict__['_tagscache']
 
         return clearcache