[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

Xiang Zhang report at bugs.python.org
Mon May 23 23:55:38 EDT 2016


Xiang Zhang added the comment:

This seems to be designed. From PEP343 it tells clearly:

    If either of the relevant methods are not found
    as expected, the interpreter will raise AttributeError, in the
    order that they are tried (__exit__, __enter__).

But currently I don't find out why.

----------
nosy: +xiang.zhang

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27100>
_______________________________________


More information about the Python-bugs-list mailing list