Python __exit__ returning self (or any truthy value) silently swallows exceptions from the with block
A context manager's __exit__ return value means 'suppress the exception' when truthy. Writing def __exit__(self, *a): return self (or return self.close() where close returns True, or a non-empty string) makes with R(): raise ValueError('lost') finish normally: the exception disappears and execution continues after the block. The same happens through contextlib.ExitStack when any entered context manager returns a truthy value, so unrelated errors raised later in the stack's block are swallowed too. ExitStack runs callbacks in LIFO order. Fix: return None (or an explicit False) from __exit__ unless suppression is intended, and if it is, return a deliberate bool based on the exception type. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7.