Issue1640

classification
Title: cStringIO does not complain on getvalue after close
Type: behaviour Severity: minor
Components: Library Versions: 2.5.1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, bpedman
Priority: normal Keywords:

Created on 2010-08-11.17:50:47 by bpedman, last changed 2012-03-20.23:35:20 by amak.

Messages
msg5951 (view) Author: Brandon (bpedman) Date: 2010-08-11.17:50:45
The cStringIO module in CPython says:

# Close object and discard memory buffer --
# .getvalue() will now raise an exception

I was expecting this to happen in a little script but it did not raise an exception (not relying on it, just testing some things out)

In Jython 2.5.1 I close the StringIO object and it will still return the string buffer

Looking at the source it looks like all close() does is set a flag. In reality it should clear out the buffer to free the memory and raise an exception if getvalue() is called after close
msg6944 (view) Author: Alan Kennedy (amak) Date: 2012-03-20.23:12:40
Your analysis is correct. I'm working on a fix.
msg6945 (view) Author: Alan Kennedy (amak) Date: 2012-03-20.23:35:20
Fix checked in at

2.5:  http://hg.python.org/jython/rev/64e2170c655e
head: http://hg.python.org/jython/rev/6163f0c0208f

Resolving this issue as fixed.
History
Date User Action Args
2012-03-20 23:35:20amaksetstatus: open -> closed
resolution: fixed
messages: + msg6945
2012-03-20 23:12:40amaksetassignee: amak
messages: + msg6944
2012-03-19 20:37:11amaksetnosy: + amak
2010-08-22 22:39:45zyasoftsetpriority: normal
2010-08-11 17:50:47bpedmancreate