PEP 707: A simplified signature for __exit__ and __aexit__

On most days.

Thank you!

That’s too early:

>>> class C:
...     def __enter__(self): return self
... 
>>> C.__exit__ = lambda *arg : print('exit with', arg) 
>>> 
>>> with C(): 1/0
... 
exit with (<__main__.C object at 0x109946fe0>, <class 'ZeroDivisionError'>, ZeroDivisionError('division by zero'), <traceback object at 0x109947070>)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
>>>

But we can achieve the same performance optimization with specialization/caching in the bytecode.