comparison mercurial/util.py @ 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 02b17231f6c3
children 89a2afe31e82
comparison
equal deleted inserted replaced
45145:aea246bc04bd 45146:a0791bfd9cfa
1379 finally: 1379 finally:
1380 tr.release() 1380 tr.release()
1381 1381
1382 1382
1383 @contextlib.contextmanager 1383 @contextlib.contextmanager
1384 def nullcontextmanager(): 1384 def nullcontextmanager(enter_result=None):
1385 yield 1385 yield enter_result
1386 1386
1387 1387
1388 class _lrucachenode(object): 1388 class _lrucachenode(object):
1389 """A node in a doubly linked list. 1389 """A node in a doubly linked list.
1390 1390