[issue40235] confusing documentation for IOBase.__exit__

2020-04-21 Thread Daniel Holth
Daniel Holth added the comment: Possibly the best io module example I've found https://github.com/python/cpython/blob/master/Lib/_compression.py -- ___ Python tracker ___

[issue40235] confusing documentation for IOBase.__exit__

2020-04-11 Thread Daniel Holth
Daniel Holth added the comment: Thanks, I'm sorry I didn't save when I was having my strange problem. The io module is still practically undocumented. It should have examples subclasses for each class, perhaps a link to the PEP and a link to a Python implementation of the module.

[issue40235] confusing documentation for IOBase.__exit__

2020-04-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I cannot reproduce the issue. __exit__() calls close(). >>> import io >>> class F(io.IOBase): ... def close(self): ... print('close') ... super().close() # set closed = True ... >>> with F(): pass ... close -- nosy:

[issue40235] confusing documentation for IOBase.__exit__

2020-04-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: Please post or attach *minimal* and complete (runnable as is) code that does not do what you expect. -- nosy: +terry.reedy ___ Python tracker

[issue40235] confusing documentation for IOBase.__exit__

2020-04-08 Thread Daniel Holth
New submission from Daniel Holth : 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: