Closed rec closed 4 years ago
This is challenging though not impossible.
I did quite a bit of the work here: https://github.com/rec/safer/blob/x-in-memory/safer.py#L164-L258
But then I realized that the whole point of this is things like streams from sockets, where safer
isn't going to either close or open them.
So I need to split out a context manager somehow.
More thought is needed.
More thought was given. It is done and in fact is now the default.
https://www.reddit.com/r/programming/comments/g474ig/safer_a_safer_file_writer_for_python/fnwwbko/