[issue25489] sys.exit() caught in exception handler

R. David Murray report at bugs.python.org
Wed Oct 28 10:49:54 EDT 2015


R. David Murray added the comment:

Using sys.exit means you are depending on garbage collection to clean up all of your program's resources.  In the general case this is a bad idea.  A better design is to call loop.stop, and then do cleanup (which might involve calling some wait_closed functions via loop.run_until_complete).  If you just call sys.exit, your resources may not get cleaned up correctly, or may not get cleaned up correctly somewhat randomly due to the indeterminacies in the order in which garbage collection is done.  This may not matter for a simple program, but I find it makes it easier for me if I just do it "the right way" always :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25489>
_______________________________________


More information about the Python-bugs-list mailing list