Skip to content

Conversation

@malcolmsailor
Copy link
Contributor

Realizes #1415.

One difference between my new code and subConverter.writeDataStream() is that the latter calls fp.close() when fp is a file-like object. However, I don't think this is really ideal---if the caller is passing an open file, they probably expect it to remain open. (They may, for example, wish to continue writing to it later.) And in the case of writing to StringIO objects, (which is my use case) StringIO buffer contents are discarded when calling StringIO.close().

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 93.077% when pulling e3f913f on malcolmsailor:roman-file-writing into 00971f4 on cuthbertLab:master.

@mscuthbert
Copy link
Member

does this work with BytesIO ? Actually, I'm thinking that we should be getting rid of the encoding='utf-8' above anyhow -- that's old Python 2 code still living in here. If we did that then we wouldn't need to worry about BytesIO -- people will be expected to pass in an object that can have strings written to it.

@mscuthbert
Copy link
Member

though maybe the encoding doesn't harm anything,

@mscuthbert mscuthbert merged commit 29b67ed into cuthbertLab:master Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants