Message266219
Attempting to use class that has both __exit__() and __enter__() undefined as a context manager yields an AttributeError referring to __exit__:
>>> class A():
... pass
...
>>> with A():
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: A instance has no attribute '__exit__'
Knowing that the 'with' statement should first execute __enter__, this is unexpected.
The patch ensures the attribute error refers to __enter__() when both methods are undefined. |
|
Date |
User |
Action |
Args |
2016-05-24 03:28:37 | ellingtonjp | set | recipients:
+ ellingtonjp, rhettinger |
2016-05-24 03:28:37 | ellingtonjp | set | messageid: <1464060517.76.0.559675330412.issue27100@psf.upfronthosting.co.za> |
2016-05-24 03:28:37 | ellingtonjp | link | issue27100 messages |
2016-05-24 03:28:37 | ellingtonjp | create | |
|