Patchwork D7282: vfs: suppress some pytype errors around us using a private attribute

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 11:23 p.m.
Message ID <29d48fa6ded51f061784937f0817a9d8@localhost.localdomain>
Download mbox | patch
Permalink /patch/42851/
State Not Applicable
Headers show

Comments

phabricator - Nov. 6, 2019, 11:23 p.m.
durin42 updated this revision to Diff 17669.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7282?vs=17652&id=17669

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

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

AFFECTED FILES
  mercurial/vfs.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -307,7 +307,10 @@ 
         # Sharing backgroundfilecloser between threads is complex and using
         # multiple instances puts us at risk of running out of file descriptors
         # only allow to use backgroundfilecloser when in main thread.
-        if not isinstance(threading.currentThread(), threading._MainThread):
+        if not isinstance(
+            threading.currentThread(),
+            threading._MainThread,  # pytype: disable=module-attr
+        ):
             yield
             return
         vfs = getattr(self, 'vfs', self)
@@ -318,10 +321,14 @@ 
 
         with backgroundfilecloser(ui, expectedcount=expectedcount) as bfc:
             try:
-                vfs._backgroundfilecloser = bfc
+                vfs._backgroundfilecloser = (
+                    bfc  # pytype: disable=attribute-error
+                )
                 yield bfc
             finally:
-                vfs._backgroundfilecloser = None
+                vfs._backgroundfilecloser = (
+                    None  # pytype: disable=attribute-error
+                )
 
 
 class vfs(abstractvfs):
@@ -477,7 +484,8 @@ 
             fp = checkambigatclosing(fp)
 
         if backgroundclose and isinstance(
-            threading.currentThread(), threading._MainThread
+            threading.currentThread(),
+            threading._MainThread,  # pytype: disable=module-attr
         ):
             if not self._backgroundfilecloser:
                 raise error.Abort(