Antti Haapala <an...@haapala.name> added the comment:

Another test case:

import tempfile
import io
import json


with tempfile.SpooledTemporaryFile(max_size=2**20) as f:
    tf = io.TextIOWrapper(f, encoding='utf-8')
    json.dump({}, fp=tf)

I was writing json to a file-like object that I need to read in as binary (to 
upload to S3). Originally the code used BytesIO and I thought it would be wise 
to actually spool this to disk as I was operating with possible limited RAM... 
except that of course it didn't work.

----------
nosy: +ztane

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26175>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to