[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-13 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, yes, I failed to account for the additional string escaping performed by the IO stream. I think I've been bitten by that before, but I always forget since I try to always use forward slashes for paths, even on Windows. r87212 modifies the test to ensure tha

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: A test still fails under Windows: == FAIL: test_warnings_on_cleanup (test.test_tempfile.test_TemporaryDirectory) -- Traceback

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: Sorry, I realised after I had logged off and gone to bed that I hadn't finished the last test. Fixed in r87204 with an approach that should exercise the relevant behaviour regardless of platform. The commit message has also been updated to refer to the correct

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-12 Thread R. David Murray
R. David Murray added the comment: There's also a typo in the issue number in your commit message (10888 instead of 10188). -- ___ Python tracker ___ __

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-12 Thread R. David Murray
R. David Murray added the comment: The tests are failing on windows: http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/3770/steps/test/logs/stdio == ERROR: test_mkdtemp_failure (test.test_tempfile.test_Te

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: Tidy ups committed in r87182. Shutdown problems now result in a slightly more meaningful message on stderr, a ResourceWarning is triggered when an implicit teardown occurs and the chances of an AttributeError due to an exception in __init__ are minimised.

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-11 Thread Nick Coghlan
Nick Coghlan added the comment: Although it may be better to just raise a new, more meaningul, exception and let the runtime take care of ignoring it (since it happens in __del__) -- ___ Python tracker __

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-11 Thread Nick Coghlan
Nick Coghlan added the comment: I have a slightly better fix for that coming soon. There's a subtle race condition in the proposed approach that can lead to the temporary dir not being deleted if an asynchronous exception, such as KeyboardInterrupt, arrives after mkdtemp completes successfull

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-11 Thread Georg Brandl
Georg Brandl added the comment: Applied the fix from msg123808 in r87172. -- nosy: +georg.brandl ___ Python tracker ___ ___ Python-bu

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-11 Thread Jurko Gospodnetić
Jurko Gospodnetić added the comment: Clicked send too soon on the previous comment. :-( The simplest way I see you can fix the __del__ issue is to patch TemporaryDirectory.__init__() as follows: def __init__(self, suffix="", prefix=template, dir=None): self._closed = True

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-12-11 Thread Jurko Gospodnetić
Jurko Gospodnetić added the comment: Also this class, because it defines __del__ too simply, will display a user-unfriendly error message when cleaning up a TemporaryDirectory object whose constructor raised an exception when attempting to create its temporary folder. For example try to cr

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-10-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: Shutdown has been a 'forever' problem ;-). It would seem sensible to me to have a fixed end-of-shutdown sequence for essential modules. -- nosy: +terry.reedy ___ Python tracker _

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-10-24 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo versions: +Python 3.2 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-10-24 Thread Nick Coghlan
Nick Coghlan added the comment: Cleanup of sys and __builtin__ is already delayed - this particular issue could be fixed by delaying cleanup of a few more modules, along with the proposed change to GC invocation in issue #1545463. -- ___ Python tra

[issue10188] tempfile.TemporaryDirectory may throw errors at shutdown

2010-10-24 Thread Nick Coghlan
New submission from Nick Coghlan : During interpreter shutdown, modules can become unusable as module globals are set to None. This is a problem for tempfile.TemporaryDirectory, as it needs working os, os.path and stat modules in order to clean up the filesystem. The class makes a valiant atte