|
From: <bc...@wo...> - 2001-09-02 18:34:44
|
In the second half on the bugreport:
> [ #448398 ] open('test.txt','w').write('test') fails
> http://sourceforge.net/tracker/index.php?func=detail&aid=448398&group_id=12867&atid=112867
it is hinted that sys.exit() could close open python files.
I haven't made up my mind about it yet. We could register open PyFile
instances in a global collection and have some exit code that close all
the files in the collection. An implementation would probably have to
use weak references on java2. On java1 the GC'ing of files would then be
disabled, which means that we must have a way of disabling the entire
close-at-exit feature.
It feels like a lot of code with only a little gain but I'm not
dismissing it completely because the current behaviour result in
complete and silent loss of a lot of information.
Is it worth the trouble? Of so, what should the default be? Enabled
close-at-exit for java2 and disabled for java1?
Note 1: I'm not even considering changing the behaviour for
open('test.txt','w').write('test')
Code like that will still not close the file immediately.
Note 2: Supporting the buffer size argument could be another workaround.
At the moment python files are always buffered and while disabling
buffering could help for the example code, the two issues (close-at-exit
and buffering) are different problems.
regards,
finn
|