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

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 3:47 a.m.
Message ID <6e4cf91d1cd62bc0115730608534dba5@localhost.localdomain>
Download mbox | patch
Permalink /patch/42795/
State Not Applicable
Headers show

Comments

phabricator - Nov. 6, 2019, 3:47 a.m.
Closed by commit rHGbe384a2052aa: py3: don&#039;t use bytes with vars() or __dict__ (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7230?vs=17558&id=17599

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

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, indygreg
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