Message366032
The io documentation says:
IOBase is also a context manager and therefore supports the with statement. In this example, file is closed after the with statement’s suite is finished—even if an exception occurs:
with open('spam.txt', 'w') as file:
file.write('Spam and eggs!')
I read this to mean that my own subclass of io.BufferedIOBase would call close() when used as a context manager.
Instead, it is necessary to provide an implementation of __exit__ that calls close() to get this behavior.
The documentation lists Mixin Methods, but I couldn't find a definition of the term "Mixin Methods" in the docs. |
|
Date |
User |
Action |
Args |
2020-04-09 03:47:22 | dholth | set | recipients:
+ dholth |
2020-04-09 03:47:22 | dholth | set | messageid: <1586404042.0.0.215231917986.issue40235@roundup.psfhosted.org> |
2020-04-09 03:47:21 | dholth | link | issue40235 messages |
2020-04-09 03:47:21 | dholth | create | |
|