Mercurial > hg
comparison mercurial/vfs.py @ 47178:63286e0886a6
vfs: Fix deprecation warning in Python 3.10 (issue6520)
Differential Revision: https://phab.mercurial-scm.org/D10710
author | Karthikeyan Singaravelan <tir.karthi@gmail.com> |
---|---|
date | Fri, 14 May 2021 10:01:29 +0000 |
parents | d4ba4d51f85f |
children | 9ab54aa56982 |
comparison
equal
deleted
inserted
replaced
47177:5d5abfdc32d8 | 47178:63286e0886a6 |
---|---|
305 """ | 305 """ |
306 # Sharing backgroundfilecloser between threads is complex and using | 306 # Sharing backgroundfilecloser between threads is complex and using |
307 # multiple instances puts us at risk of running out of file descriptors | 307 # multiple instances puts us at risk of running out of file descriptors |
308 # only allow to use backgroundfilecloser when in main thread. | 308 # only allow to use backgroundfilecloser when in main thread. |
309 if not isinstance( | 309 if not isinstance( |
310 threading.currentThread(), | 310 threading.current_thread(), |
311 threading._MainThread, # pytype: disable=module-attr | 311 threading._MainThread, # pytype: disable=module-attr |
312 ): | 312 ): |
313 yield | 313 yield |
314 return | 314 return |
315 vfs = getattr(self, 'vfs', self) | 315 vfs = getattr(self, 'vfs', self) |
481 % mode | 481 % mode |
482 ) | 482 ) |
483 fp = checkambigatclosing(fp) | 483 fp = checkambigatclosing(fp) |
484 | 484 |
485 if backgroundclose and isinstance( | 485 if backgroundclose and isinstance( |
486 threading.currentThread(), | 486 threading.current_thread(), |
487 threading._MainThread, # pytype: disable=module-attr | 487 threading._MainThread, # pytype: disable=module-attr |
488 ): | 488 ): |
489 if ( | 489 if ( |
490 not self._backgroundfilecloser # pytype: disable=attribute-error | 490 not self._backgroundfilecloser # pytype: disable=attribute-error |
491 ): | 491 ): |