Bug description:
class CM:
def __init__(self, fail=False):
self.fail = fail
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
assert not self.fail
with (
CM(fail=True) as a,
CM() as b,
):
pass
and the traceback should tell us where this failed, right?
Traceback (most recent call last):
File "repro.py", line 12, in <module>
with (
File "repro.py", line 9, in __exit__
assert not self.fail
AssertionError
In more realistic use-cases1, it would be very helpful if the traceback pointed to line 13 CM(fail=True) as a, rather than line 12 with (.
I've tested this on Python 3.11, and searching the changelogs for 3.12/13/14 didn't show any related changes.