N
Neil Cerutti
The documentation says the following about StringIO.close:
close( )
Free the memory buffer.
Or else... what?
close( )
Free the memory buffer.
Or else... what?
Neil Cerutti said:The documentation says the following about StringIO.close:
close( )
Free the memory buffer.
Or else... what?
Or else the memory buffer sticks around, so you can keep
calling getvalue as needed. I believe the freeing will happen
anyway, eventually, if and when the StringIO instance is
garbage collected (just like, say, a file object's underlying
fd gets closed when the file object is garbage collected), but
relying on such behavior is often considered a dubious practice
nowadays (given the existence of many Python implementations
whose GC strategies differ).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.