On Tue, Apr 21, 2009 at 12:30:35AM -0700, Christopher Lee wrote: -> On Apr 20, 2009, at 10:46 PM, C. Titus Brown wrote: -> > -> I think the documentation has to say "you should always close() the -> > -> object when done with it." It is true that you can probably get -> > away -> > -> without that in most cases (especially on UNIX), because the object -> > -> will close itself when garbage collected. We've been relying on -> > that -> > -> behavior all these years on UNIX without any problem. But -> > mandating -> > -> this as standard operating procedure will save some people from -> > -> baffling bugs that arise due to some interaction between the -> > order of -> > -> deleting a file vs. when garbage collection actually deletes the -> > -> object. This seems to matter on Windows, as even our initial -> > testing -> > -> of the test suite hits that issue twice. -> > -> > I disagree; what's wrong with the default Python behavior of closing -> > things when GCed?! The test environment is special because it re-uses -> > files, which should not generally be a problem in pygr use. -> -> Yes, on UNIX I have never encountered a problem, but on Windows even -> our basic test suite has hit this problem twice (testing on Cygwin). -> To me that implies that relying on GC behavior is not adequate -> protection on the Windows platform, and that Windows users will have -> problems. Such problems will probably be subtle and baffling (e.g. -> highly order / context sensitive). So you could view this as one of -> those "safety first" best-practices that you follow (even if 95% of -> the time it's not actually necessary) because of the 5% of cases where -> it saves you from real misery. (e.g. I wasted several hours on Friday -> tracking down this problem in the test suite, instead of doing -> productive work. It seems ironic to me that according to your -> proposal this problem would be called "not a Pygr bug" but would -> instead be blamed on the user code, in this case the -> SequenceFileDB_Creation_Test test cases. And I'm still not even sure -> I understand why this bug occurs, i.e. why your "del db" statement -> doesn't achieve the equivalent of a db.close()... Is this just a -> demonstration that GC timing is unpredictable?)
Yes, I think so. We've had to force GC in the test suite in other areas, right? I think the cache test code uses it. --titus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to pygr-dev@googlegroups.com To unsubscribe from this group, send email to pygr-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---