changeset 45146:a0791bfd9cfa

util: enhance `nullcontextmanager` to be able to return __enter__ result This makes its functionality and signature equivalent to Python 3.7’s contextlib.nullcontext().
author Manuel Jacob <me@manueljacob.de>
date Thu, 16 Jul 2020 23:49:04 +0200
parents aea246bc04bd
children c2c862b9b544
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Jul 17 03:12:29 2020 +0200
+++ b/mercurial/util.py	Thu Jul 16 23:49:04 2020 +0200
@@ -1381,8 +1381,8 @@
 
 
 @contextlib.contextmanager
-def nullcontextmanager():
-    yield
+def nullcontextmanager(enter_result=None):
+    yield enter_result
 
 
 class _lrucachenode(object):