summaryrefslogtreecommitdiff
path: root/kazoo/python2atexit.py
diff options
context:
space:
mode:
Diffstat (limited to 'kazoo/python2atexit.py')
-rw-r--r--kazoo/python2atexit.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kazoo/python2atexit.py b/kazoo/python2atexit.py
index a7f9e85..fdf78d2 100644
--- a/kazoo/python2atexit.py
+++ b/kazoo/python2atexit.py
@@ -25,8 +25,9 @@ def _run_exitfuncs():
func(*targs, **kargs)
except SystemExit:
exc_info = sys.exc_info()
- except:
+ except: # noqa
import traceback
+
sys.stderr.write("Error in atexit._run_exitfuncs:\n")
traceback.print_exc()
exc_info = sys.exc_info()
@@ -64,6 +65,7 @@ def unregister(func):
for e in handler_entries:
_exithandlers.remove(e)
+
if not hasattr(atexit, "unregister"):
# Only in python 2.x
atexit.register(_run_exitfuncs)